Stefan Krah added the comment:
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')
----------
nosy: +skrah
resolution: -> not a bug
stage: -> resolved
status: open -> closed
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue31435>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com