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 Aodhán Collins, skrah
Date 2017-09-12.20:17:03
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1505247423.25.0.309003032858.issue31435@psf.upfronthosting.co.za>
In-reply-to
Content
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')
History
Date User Action Args
2017-09-12 20:17:03skrahsetrecipients: + skrah, Aodhán Collins
2017-09-12 20:17:03skrahsetmessageid: <1505247423.25.0.309003032858.issue31435@psf.upfronthosting.co.za>
2017-09-12 20:17:03skrahlinkissue31435 messages
2017-09-12 20:17:03skrahcreate