[Python-bugs-list] [ python-Bugs-776805 ] Bug in float objects

SourceForge.net noreply@sourceforge.net
Thu, 24 Jul 2003 01:00:28 -0700


Bugs item #776805, was opened at 2003-07-24 16:00
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=776805&group_id=5470

Category: Python Library
Group: Python 2.2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Mukhsein Johari (mukhsein)
Assigned to: Nobody/Anonymous (nobody)
Summary: Bug in float objects

Initial Comment:
There seems to be a bug in floats. This is present in
2.2.1 through 2.2.3 - don't know about 2.3. It exists
in Linux Mandrake and Red Hat and FreeBSD. On P3, P4
and Athlon.

Tests like:
0.4+0.2 <= 0.6
evals to 0

See the following for details:

Python 2.2.3 (#1, Jul 24 2003, 12:44:45)
[GCC 2.95.4 20020320 [FreeBSD]] on freebsd4
Type "help", "copyright", "credits" or "license" for
more information.
>>> 0.1
0.10000000000000001
>>> 0.11
0.11
>>> 0.12
0.12
>>> 0.2
0.20000000000000001
>>> 0.3
0.29999999999999999
>>> 0.4
0.40000000000000002
>>> 0.5
0.5
>>> 0.6
0.59999999999999998
>>> 0.7
0.69999999999999996
>>> 0.8
0.80000000000000004
>>> 0.9
0.90000000000000002
>>> 0.10
0.10000000000000001
>>> 0.1000
0.10000000000000001

>>> 0.3
0.29999999999999999
>>> 0.03
0.029999999999999999
>>> 0.003
0.0030000000000000001
>>> 0.0003
0.00029999999999999997

>>> print 0.1
0.1
>>> print 0.2
0.2
>>> print 0.3
0.3


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=776805&group_id=5470