classification
Title: calculation wrong rounding
Type: Stage:
Components: Macintosh Versions:
process
Status: closed Resolution: invalid
Dependencies: Superseder:
Assigned To: jackjansen Nosy List: buzz42, jackjansen, tim_one (3)
Priority: normal Keywords

Created on 2004-12-20 18:29 by buzz42, last changed 2004-12-20 19:09 by tim_one.

Messages (2)
msg23785 - (view) Author: Sebastian Rockel (buzz42) Date: 2004-12-20 18:29
I am using python 2.4 on MAC OS 10.3.7 with gcc V3.3 20030304 
(Apple Computer, Inc. build 1666)

It is a simple calculation. There seems to be a little rounding 
problem:
>>> 4053020.7+10*324241.6
7295436.7000000002

It shoult be of course 7295436.7

msg23786 - (view) Author: Tim Peters (tim_one) Date: 2004-12-20 19:09
Logged In: YES 
user_id=31435

Please read the Appendix about floating-point issues in the 
Python Tutorial -- what you're seeing is an unavoidable 
consquence of using binary floating-point hardware.  If you 
require exact decimal representations, use the new 
``decimal`` module intead.
History
Date User Action Args
2004-12-20 18:29:34buzz42create