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 skrah
Recipients ahmad dana, eric.smith, remi.lapeyre, skrah, steven.daprano
Date 2020-04-07.10:44:04
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1586256245.07.0.189420595344.issue40206@roundup.psfhosted.org>
In-reply-to
Content
You can also set the decimal.FloatOperation trap to avoid accidental
errors:

>>> from decimal import *
>>> c = getcontext()
>>> Decimal(4.6) * 100
Decimal('459.9999999999999644728632120')

>>> c.traps[FloatOperation] = True
>>> Decimal(4.6) * 100
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
decimal.FloatOperation: [<class 'decimal.FloatOperation'>]

>>> Decimal("4.6") * 100
Decimal('460.0')
>>>
History
Date User Action Args
2020-04-07 10:44:05skrahsetrecipients: + skrah, eric.smith, steven.daprano, remi.lapeyre, ahmad dana
2020-04-07 10:44:05skrahsetmessageid: <1586256245.07.0.189420595344.issue40206@roundup.psfhosted.org>
2020-04-07 10:44:05skrahlinkissue40206 messages
2020-04-07 10:44:04skrahcreate