|
|
Subscribe / Log in / New account

Native Python support for units?

Native Python support for units?

Posted Jul 15, 2022 21:00 UTC (Fri) by jrwren (subscriber, #97799)
In reply to: Native Python support for units? by niner
Parent article: Native Python support for units?

> The number "4K" might mean four kelvins, 4000, or 4096, depending on context

Only if it is implemented poorly. SI clearly defines K as Kelvins, period. k is kilo and ki is kibi (although maybe not SI)

https://www.nist.gov/pml/owm/metric-si-prefixes


to post comments

Native Python support for units?

Posted Jul 18, 2022 14:44 UTC (Mon) by jwilk (subscriber, #63328) [Link]

Kibi is "Ki" (with uppercase K) and indeed not SI.

Native Python support for units?

Posted Jul 19, 2022 20:54 UTC (Tue) by p6steve (guest, #159775) [Link]

Physics::Measure & Physics::Unit follow the SI conventions for 'K' and 'k' (plus many non-SI conversions)
#viz. https://en.wikipedia.org/wiki/International_System_of_Units

say 29K.in('°C'); # -244.15°C
say 29km.in('miles'); # 18.019765mile

Sadly, Kibi (and other computing units are not yet implemented)


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds