[issue31684] Scientific formatting of decimal 0 different from float 0
Stefan Krah
report at bugs.python.org
Wed Oct 4 15:02:15 EDT 2017
Stefan Krah <stefan at bytereef.org> added the comment:
> I'm also assuming that Decimal(0) sets both base and exponent to 0.
No, 0 is really special in the IBM specification. The magnitude is
kept, the precision is not.
>>> Decimal("0e10") * Decimal("0e20")
Decimal('0E+30')
>>> Decimal("0.000e10")
Decimal('0E+7')
So we're basically doing the reverse of the above in formatting when a
precision is given.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue31684>
_______________________________________
More information about the Python-bugs-list
mailing list