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 zach.ware
Recipients Rihards, zach.ware
Date 2014-02-06.20:21:08
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1391718069.1.0.946645776623.issue20533@psf.upfronthosting.co.za>
In-reply-to
Content
Hi Rihards,

This is not a bug, this is an example of the limitations of binary floating point arithmetic.  See http://docs.python.org/3/tutorial/floatingpoint.html for more information.  For explanation by demonstration, have a look at this:

Python 3.3.2 (v3.3.2:d047928ae3f6, May 16 2013, 00:03:43) [MSC v.1600 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from decimal import Decimal as D
>>> D(11.29)
Decimal('11.28999999999999914734871708787977695465087890625')
>>> D(6.29)
Decimal('6.29000000000000003552713678800500929355621337890625')
>>> D(11.30)
Decimal('11.300000000000000710542735760100185871124267578125')
>>> D(6.30)
Decimal('6.29999999999999982236431605997495353221893310546875')
>>> D(11.291)
Decimal('11.291000000000000369482222595252096652984619140625')
>>> D(6.291)
Decimal('6.291000000000000369482222595252096652984619140625')
>>> 11.29 - 6.29
4.999999999999999
>>> 11.30 - 6.30
5.000000000000001
>>> 11.291 - 6.291
5.0
>>> D(11.29) - D(6.29)
Decimal('4.999999999999999111821580300')
>>> D(11.30) - D(6.30)
Decimal('5.000000000000000888178419700')
>>> D(11.291) - D(6.291)
Decimal('5.000000000000000000000000000')
>>>

For future reference, "bug?" isn't very useful as an issue title :).  The title should be as brief a summary of the possible bug as you can come up with, or at least mention which part(s) of Python are affected.
History
Date User Action Args
2014-02-06 20:21:09zach.waresetrecipients: + zach.ware, Rihards
2014-02-06 20:21:09zach.waresetmessageid: <1391718069.1.0.946645776623.issue20533@psf.upfronthosting.co.za>
2014-02-06 20:21:09zach.warelinkissue20533 messages
2014-02-06 20:21:08zach.warecreate