Message272431
On Thu, Aug 11, 2016 at 09:17:10AM +0000, Antti Haapala wrote:
> However the *precision* of decimals is meaningless anyhow. Add a very precisely measured '0e0' to any number and the sum also has exponent of 0, and is thus never displayed in exponential notation.
It is not meaningless and actually one of the most important features of decimal:
>>> x = Decimal("3.6")
>>> y = Decimal("0.0000000000000000000000") # number "measured" with ridiculous precision
>>> x.to_eng_string()
'3.6'
>>> (x + y).to_eng_string()
'3.6000000000000000000000'
>>> x = Decimal("3.6")
>>> y = Decimal("0e-7") # perhaps more realistic
>>> (x + y).to_eng_string()
'3.6000000'
If you have confidence in your measurement, you have to let decimal know
by actually spelling it out. |
|
Date |
User |
Action |
Args |
2016-08-11 09:41:10 | skrah | set | recipients:
+ skrah, tim.peters, rhettinger, facundobatista, mark.dickinson, eric.smith, ezio.melotti, Keith.Brafford, ztane, serge.stroobandt |
2016-08-11 09:41:10 | skrah | link | issue26223 messages |
2016-08-11 09:41:09 | skrah | create | |
|