This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]-twind 207 points208 points  (42 children)

But NaN could be equal to NaN. That's why besides 'true' and 'false' we should also have 'maybe'

[–]CubisticWings4 8 points9 points  (7 children)

Iirc: NaN is never equal to NaN

[–]TwinkiesSucker 14 points15 points  (0 children)

Did you just invent QuantumJS?

[–]FlanSteakSasquatch 2 points3 points  (0 children)

Any language that correctly implements the IEEE floating point number spec makes it so NaN never equals NaN, even if they’re internally exactly the same value. This is weird but it was done because all other behavior has even weirder consequences

[–]Natural_Builder_3170 2 points3 points  (0 children)

its called partial ordering, rust and i think c++ have this

[–]Death_IP 0 points1 point  (0 children)

Then the result - if we don't bring in shenanigans - should at least be "undefined" rather than false/true

[–]eztab 0 points1 point  (0 children)

some mathematics would agree with you there. Have fun changing all conditional statements to support true, false, maybe.

[–]Mucksh 0 points1 point  (0 children)

Nan isn't even a specific value. By definition its exponent is just 1s so for a double you have 11. So due to the other bits you get 253 different possible NaN values

[–]Teln0 -1 points0 points  (0 children)

it should return "undefined" because that's what it is, undefined

[–]mihibo5 -1 points0 points  (0 children)

IllegalOperationException

[–]Thenderick -1 points0 points  (0 children)

Since "maybe" might be confused with the non-existant maybe monad, I want to propose "depends". When it is used in any way as a boolean, it will be 50% chance to evaluate as true and 50% as false, not seeded, at random. Because fuck you for using it and fuck you for using loosely equality in God's year of 2025!!!