Message365903
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')
>>> |
|
Date |
User |
Action |
Args |
2020-04-07 10:44:05 | skrah | set | recipients:
+ skrah, eric.smith, steven.daprano, remi.lapeyre, ahmad dana |
2020-04-07 10:44:05 | skrah | set | messageid: <1586256245.07.0.189420595344.issue40206@roundup.psfhosted.org> |
2020-04-07 10:44:05 | skrah | link | issue40206 messages |
2020-04-07 10:44:04 | skrah | create | |
|