Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upUnifier thinks 0.0 = -0.0 which means you can prove Void #2609
Comments
This comment has been minimized.
This comment has been minimized.
|
This originally came about as a discussion of:
Which itself came about in a discussion of how NaN behaves in types (it's interesting when |
This comment has been minimized.
This comment has been minimized.
ghost
commented
Sep 12, 2015
|
I'll add that the fact that two NaNs won't unify is also potentially an issue, but we weren't able to find a way to get |
eddyb
referenced this issue
Sep 12, 2015
Closed
Parameterize types over numerics / type level integers #1038
This comment has been minimized.
This comment has been minimized.
|
The suggestion in the channel was bit-pattern identity for floats. This would make some The proposal would also make |
This comment has been minimized.
This comment has been minimized.
|
IEEE describes an equality test (and indeed a partial order) for floats which includes that negative zero is equal to positive zero, and that every NaN is incomparable with every NaN including itself. However it also describes a total order which will differentiate these cases, including different NaNs, and order them all, in such a way that Which is to say, there is apparently a specific provision for this sort of requirement, and even a stronger one than ours. Now we just have to find implementations. |
This comment has been minimized.
This comment has been minimized.
ghost
commented
Sep 13, 2015
|
Interesting! My feeling about comparisons is that The unification thing for NaNs means that writing patterns is hard, but in practice we would be better served by some sort of |
This comment has been minimized.
This comment has been minimized.
|
Since there is no literal form for NaNs, you can’t match on them in the first place. Edit: Wait, you mean |
This comment has been minimized.
This comment has been minimized.
|
Allow me to add a possibly slightly prettier version of the proof at the beginning:
|
david-christiansen
added a commit
to david-christiansen/Idris-dev
that referenced
this issue
Apr 8, 2016
david-christiansen
referenced this issue
Apr 8, 2016
Merged
Use bit-pattern identity for Double #3101
This comment has been minimized.
This comment has been minimized.
|
I think that my concerns about bit-pattern identity for |
enolan commentedSep 12, 2015
This isn't my discovery, this is copypasta from discussion on the IRC. Credit to {AS}, scshunt, Melvar and ladyfriday.
To explain, 1/-0.0 is -Infinity and 1/0.0 is +Infinity, so we have -Infinity = Infinity, False = True, and then Void. The unifier needs to be more precise about what floats are and aren't equal.