[Python-bugs-list] [ python-Bugs-426345 ] Problem with addition
noreply@sourceforge.net
noreply@sourceforge.net
Tue, 22 May 2001 12:43:36 -0700
Bugs item #426345, was updated on 2001-05-22 09:58
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=426345&group_id=5470
Category: None
>Group: Not a Bug
>Status: Closed
>Resolution: Invalid
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Nobody/Anonymous (nobody)
Summary: Problem with addition
Initial Comment:
There seems to be a problem with addition in the
python interactive mode. This is what I did:
"""
[administrator@RGELPC265 delacruz]$ python
Python 2.1 (#1, Apr 17 2001, 09:45:01)
[GCC 2.95.3-2 (cygwin special)] on cygwin_nt-4.01
Type "copyright", "credits" or "license" for more
information.
>>> 3.76 + 4.72
8.4800000000000004
"""
Here are my specs:
Python Release: Python 2.1 (#1, Apr 17 2001, 09:45:01)
Platform: Windows 2000
Shell: cygwin
----------------------------------------------------------------------
Comment By: Tim Peters (tim_one)
Date: 2001-05-22 12:43
Message:
Logged In: YES
user_id=31435
This is not a bug.
Binary floating point cannot represent decimal fractions exactly,
so some rounding always occurs (even in Python 1.5.2).
What changed is that Python 2.0 shows more precision than before
in certain circumstances (repr() and the interactive prompt).
You can use str() or print to get the old, rounded output:
>>> print 0.1+0.1
0.2
>>>
Follow the link for a detailed example:
http://www.python.org/cgi-bin/moinmoin/RepresentationError
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=426345&group_id=5470