-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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 operations and test #307
Comments
That's not a bug, that's how floating point works |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I met a nasty bug that will now wake me up at night... It concerns floating point operations and I feel like it is not really included in your list. Note that one could argue this problem is not python specific but it still caused some nasty bug and people might want to be aware of this. (This blog reminded me of the bug and helped me formulate it more clearly here). It boils down to:
1 + 2 == 3
True
(1 + 2)/10 == 3/10
True
1/10 + 2/10 == 3/10
False
.1 + .2 == .3
False
And of course :
0.3 - 0.2 - 0.1 == 0
False
The text was updated successfully, but these errors were encountered: