classification
Title: Bad result of calculation
Type: Stage:
Components: Interpreter Core Versions: Python 2.4
process
Status: closed Resolution: invalid
Dependencies: Superseder:
Assigned To: Nosy List: georg.brandl, jbertoli (2)
Priority: normal Keywords

Created on 2006-08-22 07:15 by jbertoli, last changed 2006-08-22 08:20 by georg.brandl.

Files
File name Uploaded Description Edit Remove
py_calc.PNG jbertoli, 2006-08-22 07:15 wrong_digits
Messages (2)
msg29610 - (view) Author: Jean-Christophe BERTOLINI (jbertoli) Date: 2006-08-22 07:15
In the Python Shell enter:
>>> 3.84-4.5
-0.66000000000000014

The last digits of the calculation result are wrong
msg29611 - (view) Author: Georg Brandl (georg.brandl) Date: 2006-08-22 08:20
Logged In: YES 
user_id=849994

This is due to how floats work. See
http://www.python.org/doc/faq/general/#why-are-floating-point-calculations-so-inaccurate
.
History
Date User Action Args
2006-08-22 07:15:10jbertolicreate