This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mark.dickinson
Recipients facundobatista, mark.dickinson, rhettinger, sim1234
Date 2021-02-24.12:03:57
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1614168237.39.0.00372502116004.issue43315@roundup.psfhosted.org>
In-reply-to
Content
This is by design: the choice of -6 is not arbitrary, but follows the standard that the Decimal class is based on. Quoting from http://speleotrove.com/decimal/daconvs.html#reftostr:

> If the exponent is less than or equal to zero and the adjusted exponent is greater than or equal to -6, [...]

"str" isn't parameterizable (at least, not without a major change to the way that Python works), so if you're using it you have to accept the compromises it makes. If you want finer control over the string representation of Decimal objects, use Python's formatting capabilities:

    >>> from decimal import Decimal
    >>> x = Decimal("1e-8")
    >>> format(x, 'f')
    '0.00000001'
History
Date User Action Args
2021-02-24 12:03:57mark.dickinsonsetrecipients: + mark.dickinson, rhettinger, facundobatista, sim1234
2021-02-24 12:03:57mark.dickinsonsetmessageid: <1614168237.39.0.00372502116004.issue43315@roundup.psfhosted.org>
2021-02-24 12:03:57mark.dickinsonlinkissue43315 messages
2021-02-24 12:03:57mark.dickinsoncreate