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.

classification
Title: Error in additon of decimal numbers
Type: behavior Stage: resolved
Components: None Versions: Python 2.6
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: James.Sparenberg, r.david.murray
Priority: low Keywords:

Created on 2010-02-11 18:40 by James.Sparenberg, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (2)
msg99230 - (view) Author: James Sparenberg (James.Sparenberg) Date: 2010-02-11 18:40
Python produces rounding errors when adding decimals.

ython 2.6.4 (r264:75706, Dec  7 2009, 18:43:55)
[GCC 4.4.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 13.04 + 158.00
171.03999999999999
>>> 13 +158
171
>>> 13.04 + 158.00
171.03999999999999
>>> 13.04 + 158
171.03999999999999
>>> 13.04 + 0
13.039999999999999
>>> 13.05 + 0
13.050000000000001
>>>
msg99231 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2010-02-11 18:44
Read this:

http://docs.python.org/tutorial/floatingpoint.html?highlight=rounding

And then perhaps take a look at the Decimal package.
History
Date User Action Args
2022-04-11 14:56:57adminsetgithub: 52160
2010-02-11 18:44:20r.david.murraysetstatus: open -> closed
priority: low


nosy: + r.david.murray
messages: + msg99231
resolution: not a bug
stage: resolved
2010-02-11 18:40:16James.Sparenbergcreate