|
|
Subscribe / Log in / New account

Native Python support for units?

Native Python support for units?

Posted Jul 30, 2022 16:53 UTC (Sat) by Wol (subscriber, #4433)
In reply to: Native Python support for units? by NYKevin
Parent article: Native Python support for units?

Don't you mean 10e1 is 10.0 - 10 to the power 1?

Ten SQUARED is a hundred - 10e2.

Cheers,
Wol


to post comments

Native Python support for units?

Posted Jul 30, 2022 17:57 UTC (Sat) by anselm (subscriber, #2796) [Link] (4 responses)

Don't you mean 10e1 is 10.0 - 10 to the power 1?
$ python3
Python 3.9.2 (default, Feb 28 2021, 17:03:44) 
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 1e1
10.0
>>> 1e2
100.0
>>> 10e1
100.0
>>> 

Native Python support for units?

Posted Jul 30, 2022 20:34 UTC (Sat) by Wol (subscriber, #4433) [Link] (3 responses)

Hmmm my bad ...

But 10e1 is rather odd notation - 10 x 10^1

I'm used to either scientific notation where it's en and n is a multiple of 3, or (dunno what it's called) where 1 <= mantissa < 10.

( I know some people prefer the mantissa between 0 and 1, rather than 1 and 10, but the combination of mantissa not between 0 and ten, and exponent not a multiple of 3, is, well, weird!)

Cheers,
Wol

Native Python support for units?

Posted Jul 30, 2022 23:51 UTC (Sat) by rschroev (subscriber, #4164) [Link] (1 responses)

<mantissa>e<exponent> always means mantissa * 10^exponent, with whatever value for the mantissa and exponent.

When communicating with other people it's probably best to stick with either scientific notation in the strict sense (1 <= mantissa < 10) or engineering notation (exponent is a multiple of 3, 1 <= mantissa < 1000), but other representations are just as valid and programming languages don't care in the least how you scale the exponent.

Native Python support for units?

Posted Jul 31, 2022 7:50 UTC (Sun) by Wol (subscriber, #4433) [Link]

> and programming languages don't care in the least how you scale the exponent.

But brains usually do ... :-)

Cheers,
Wol

Native Python support for units?

Posted Jul 31, 2022 17:21 UTC (Sun) by anselm (subscriber, #2796) [Link]

I'm used to either scientific notation where it's en and n is a multiple of 3, or (dunno what it's called) where 1 ≤ mantissa < 10.

Scientific pocket calculators (are these still a thing?) used to call the “1 ≤ mantissa < 10 and arbitrary exponent” style “scientific” and the “1 ≤ mantissa < 1000, exponent a multiple of 3” style “engineering”.


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