-
-
Notifications
You must be signed in to change notification settings - Fork 29.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Floating point is broken in Python 2.0 #33624
Comments
Python 2.0 (#8, Oct 16 2000, 17:27:58) [MSC 32 bit (Intel)] on win32
Type "copyright", "credits" or "license" for more information.
IDLE 0.6 -- press F1 for help
>>> p=0.6
>>> p
0.59999999999999998
>>> |
This is not a bug. Binary floating point cannot represent decimal fractions exactly, What changed is that Python 2.0 shows more precision than before 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: |
Logged In: YES This is still a problem in It is a bug. Why would we expect that |
Logged In: YES You may not like it, but it's not a bug. Read the docs for |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: