Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

Measure

Helper to convert, combine and display values of the same measure in different units/magnitudes. Uses only integer values (of arbitrary precision) of a given elementary unit.

Bytes

Bytes(1,"GiB")=1GiB
Bytes(1,"GiB")-Bytes(10,"MiB")=1014MiB
Bytes(1,"GiB")/Bytes(64,"MiB")=16.0
Bytes(1,"GiB")*2=2GiB
Bytes(1,"GiB")*13.4=13GiB and 409MiB and 614KiB and 409B
(Bytes(1,"GiB")*13.4126).fmt()='13.4GiB'
(Bytes(0,"B")).fmt()='0 B'
Bytes(1,"GiB","/s")*13.5=13GiB and 512MiB/s
Bytes(1,"GiB","/s") + Bytes(5,"GiB","/s")=6GiB/s

10-base number, Currency

ShortScaleNum(4000000000).fmt()='4B'
LongScaleNum(4000000000).fmt()='4Mrd'
Dollar(4000000000).fmt()='4B$' # Dollar = ShortScale + $ suffix
Euro(4000000000,"").fmt()='4Mrd€' # Euro = LongScale + € suffix
Dollar(20,"B").fmt()='20B$'
Euro(20,"B").fmt()='20B€'

TimeDelta

TimeDelta(1,"days")=1days
TimeDelta(1,"days")-TimeDelta(30,"m")=23h and 30m
TimeDelta(1,"days")/TimeDelta(30,"m")=48.0
TimeDelta(1,"days")*15=2weeks and 1days
TimeDelta(1,"s")=1s
TimeDelta(6048200234023000000,"ps")=10weeks and 3m and 20s and 234ms and 23us
TimeDelta(6048200234023000000,"ps").fmt()='10weeks'
TimeDelta(6048200234023000000,"ps").fmt("days",fmt="{:.3f}")='70.002days'
TimeDelta(30,"h").fmt()='1.25days'
TimeDelta(0,"h")=0 ps

Length

Length(1024,"m")=1km and 24m
Length(1,"inch").fmt()='25.4mm'
Length(6,"foot").fmt()='1.83m'
Length(100,"yard").fmt()='91.4m'
Length(1,"mile").fmt("m","{:.8g}")='1609.344m'

Temperature

Using degree Celsius as elementary unit (-> no fractions).

Temperature(1,"°C").fmt()='1°C'
Temperature(1,"°F").fmt()='-17°C'
Temperature(70,"°F").fmt()='21°C'
Temperature(200,"K").fmt()='-73°C'
Temperature(200,"K")=-73°C
Temperature(400,"°F").fmt()='204°C'

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages