Mark Dickinson added the comment: The output is correct, though the tiny precision makes it look strange. The decimal module is following the usual rules for 'ideal' exponents:
- For *exactly representable* results, the ideal exponent is 0, and the output will be chosen to have exponent as close to that as possible (while not altering the value of the result). - Where the result isn't exactly representable, full precision is used. Those two rules together explain all of the output you showed: 100.0, 10.0 and 1.0 are exactly representable, so we aim for an exponent of 0. But 100.0 can't be expressed in only 2 digits with an exponent of 0, so it ends up with an exponent of 1, hence the `1.0E+2` output. 460.0 and 46.0 are similarly exactly representable. 4.6 and 0.46 are not exactly representable, so the output is given to full precision. ---------- resolution: -> invalid status: open -> pending _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue20502> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com