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: 35.5 - 29.58 = 5.920000000000002 (it's false !)
Type: behavior Stage: resolved
Components: Versions: Python 3.3, Python 3.4, Python 2.7
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: Hogren, serhiy.storchaka
Priority: normal Keywords:

Created on 2016-09-27 10:13 by Hogren, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (2)
msg277511 - (view) Author: Hogren (Hogren) Date: 2016-09-27 10:13
I was using python as calculator when I enter :
35.5 - 29.58

I am surprising when python give me a result with many decimals:
5.920000000000002

I tried to change one number :
35.5 - 29.57
The result is correct : 5.93

The error is present again when I tried to inverse numbers (29.57-35.5).

The error is again present when I tried to use 35.50 in place of 35.5.



I tested on python 2.7 and 3.4, compiled with gcc 4.9.3, on Gentoo.


Thanks for all who contribute to this good project which is Python !

Hogren
msg277512 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-09-27 10:18
https://docs.python.org/3/tutorial/floatingpoint.html
History
Date User Action Args
2022-04-11 14:58:37adminsetgithub: 72472
2016-09-27 10:18:42serhiy.storchakasetstatus: open -> closed

nosy: + serhiy.storchaka
messages: + msg277512

resolution: not a bug
stage: resolved
2016-09-27 10:13:55Hogrencreate