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 mark.dickinson
Recipients ipcctv, mark.dickinson
Date 2010-11-28.16:26:24
SpamBayes Score 4.2304833e-07
Marked as misclassified No
Message-id <1290961585.95.0.758222592283.issue10564@psf.upfronthosting.co.za>
In-reply-to
Content
> I get 114.999999999.

How many '9's are there on what you're getting?  If you really get '114.999999999' then something surprising is happening.  If, on the other hand, you get '114.99999999999999', then it's all as expected. :-)

The issue is one that affects the vast majority of popular programming languages, namely that numbers are stored internally in binary, so a number like 1.15 isn't exactly representable---you end up storing a (very good) approximation to 1.15 instead.  And then when you multiply by 100, you end up with a (very good) approximation to 115.0.

I highly recommend reading the floating-point section of the Python tutorial for an explanation of what's going on under the hood.

http://docs.python.org/dev/py3k/tutorial/floatingpoint.html
History
Date User Action Args
2010-11-28 16:26:26mark.dickinsonsetrecipients: + mark.dickinson, ipcctv
2010-11-28 16:26:25mark.dickinsonsetmessageid: <1290961585.95.0.758222592283.issue10564@psf.upfronthosting.co.za>
2010-11-28 16:26:24mark.dickinsonlinkissue10564 messages
2010-11-28 16:26:24mark.dickinsoncreate