Skip to content
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

All NaNs are unequal, but some are more unequal than others #22

Closed
cdyson37 opened this issue Nov 3, 2015 · 2 comments
Closed

All NaNs are unequal, but some are more unequal than others #22

cdyson37 opened this issue Nov 3, 2015 · 2 comments

Comments

@cdyson37
Copy link

cdyson37 commented Nov 3, 2015

Suggestion for a wat:

nan = float("nan")
print (nan == nan)                      # False
print ({1 : nan} == {1 : nan})          # True
print ({1 : nan} == {1 : float("nan")}) # False
@cosmologicon
Copy link
Owner

That's great. Looks like it works for lists too. I added it to the section on NaN-related wats. Thanks!

@cdyson37
Copy link
Author

cdyson37 commented Nov 6, 2015

I love it! Could possibly provide a hint as to why we have this behaviour by pointing out that "x is x" but "x != x" (and it's the internal assumption that the former implies the latter that's the problem). But that might detract from the beauty of the wat :)
EDIT: You did that already in explanation.md - ignore me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants