Stefan Krah added the comment:
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.
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue26223>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com