Message301992
Pythons has binary floating point, which does not give the same
results as a pocket calculator.
You can see the differences by using the decimal module:
# These are the binary floats in exact decimal representation.
>>> Decimal(7.95)
Decimal('7.95000000000000017763568394002504646778106689453125')
>>> Decimal(8.95)
Decimal('8.949999999999999289457264239899814128875732421875')
# This is exact decimal arithmetic.
>>> Decimal("8.95") + Decimal("0.95")
Decimal('9.90') |
|
Date |
User |
Action |
Args |
2017-09-12 20:17:03 | skrah | set | recipients:
+ skrah, Aodhán Collins |
2017-09-12 20:17:03 | skrah | set | messageid: <1505247423.25.0.309003032858.issue31435@psf.upfronthosting.co.za> |
2017-09-12 20:17:03 | skrah | link | issue31435 messages |
2017-09-12 20:17:03 | skrah | create | |
|