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: calculation of standard math returns incorrect value
Type: Stage:
Components: Regular Expressions Versions: Python 3.3
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: chili, ezio.melotti, mark.dickinson, mrabarnett
Priority: normal Keywords:

Created on 2013-11-27 07:21 by chili, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (3)
msg204561 - (view) Author: chili (chili) Date: 2013-11-27 07:21
Calculation of
print (162-159.9)
(IDLE and source script) returns
2.0999999999999943

I don´t make my financial calculation with this command :)
msg204562 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2013-11-27 08:06
Sorry; this is just the way that (binary) floating-point works.  See http://docs.python.org/2/tutorial/floatingpoint.html for more (or Google 'binary floating point' for a host of references).

If you're doing financial calculations, you may want to look into the decimal module: http://docs.python.org/2/library/decimal.html
msg204563 - (view) Author: chili (chili) Date: 2013-11-27 08:11
Thx for help.
History
Date User Action Args
2022-04-11 14:57:54adminsetgithub: 64006
2013-11-27 08:11:36chilisetmessages: + msg204563
2013-11-27 08:06:08mark.dickinsonsetstatus: open -> closed

nosy: + mark.dickinson
messages: + msg204562

resolution: not a bug
2013-11-27 07:28:58chilisettitle: calculation of standard math -> calculation of standard math returns incorrect value
2013-11-27 07:21:47chilicreate