[Python-bugs-list] [Bug #132399] Problem with floats in dictionary values

noreply@sourceforge.net noreply@sourceforge.net
Wed, 14 Feb 2001 13:29:38 -0800


Bug #132399, was updated on 2001-Feb-14 13:29
Here is a current snapshot of the bug.

Project: Python
Category: Python Interpreter Core
Status: Open
Resolution: None
Bug Group: None
Priority: 5
Submitted by: nobody
Assigned to : nobody
Summary: Problem with floats in dictionary values

Details: Python 2.0 seems to have a bug when using floats as the value in
a
dictionary.  Is there a fix for this that I need?

This is the Python 2.0 version of what I'm doing:

>>> x = {'a':0.4, 'b':0.4, 'c':0.4}
>>> print x
{'b': 0.40000000000000002, 'c': 0.40000000000000002, 'a':
0.40000000000000002}

But, if you just are doing this with normal scalar variables it works
fine.

>>> x = 0.4
>>> print x
0.4

And, notice the difference from the following Python 1.5.2 version below,
which treats the dictionary values correctly.

>>> x = {'a':0.4, 'b':0.4, 'c':0.4}
>>> print x
{'b': 0.4, 'c': 0.4, 'a': 0.4}



For detailed info, follow this link:
http://sourceforge.net/bugs/?func=detailbug&bug_id=132399&group_id=5470