3 ms·
I definitely support NaN not being equal to NaN in boolean logic. If you have x = "not a number", you don't want 1 + x == 2 + x to be true. There would be a l
by naet 1y ago
I definitely support NaN not being equal to NaN in boolean logic.
If you have x = "not a number", you don't want 1 + x == 2 + x to be true. There would be a lot of potential for false equivalencies if you said NaN == NaN is true.
--
It could be interesting if there was some kind of complex NaN number / NaN math. Like if x is NaN but 1x / 2x resulted in 0.5 maybe you could do some funny mixed type math. To be clear I don't think it would be good, but interesting to play with maybe.
- grogers 1y agoDoesn't "1 + x == 2 + x" evaluate to true for any x with large enough magnitude? In general we should expect identities that hold true in "real" math to not hold in FP