Floating point (in)accuracy?

Dinu Gherman dinu at reportlab.com
Wed Apr 25 11:33:55 EDT 2001


Apparently the python mailiing lists on python.org are blocked, so let

me ask here. Is there any good reason for the following behaviour to 
be different on Python 1.5.2 and 2.0?

Dinu


  Python 1.5.2 (#0, Apr 13 1999, 10:51:12) [MSC 32 bit (Intel)] on
win32
  Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
  >>> 3.14
  3.14
  >>> 10*3.14
  31.4
  >>>


  PythonWin 2.0 (#8, Oct 16 2000, 17:27:58) [MSC 32 bit (Intel)] on
win32.
  Portions Copyright 1994-2001 Mark Hammond (MarkH at ActiveState.com) -
see 'Help/About PythonWin' for further copyright information.
  >>> x = 10 * 3.14
  >>> x
  31.400000000000002
  >>> x == 31.4
  0
  >>> 3.14
  3.1400000000000001
  >>>



-- 
Dinu C. Gherman
dinu at reportlab dot com
http://www.reportlab.com
................................................................
"The only possible values [for quality] are 'excellent' and 'in-
sanely excellent', depending on whether lives are at stake or 
not. Otherwise you don't enjoy your work, you don't work well, 
and the project goes down the drain." 
                    (Kent Beck, "Extreme Programming Explained")



More information about the Python-list mailing list