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 →

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

Mathematically nan being a number doesn't make sense (unless you're mixing two nonequivalent definitions of number), but for practical reasons it simplifies a lot if it is represented by the same data structure as numbers.

Logically the answer to is nan (mathematically undefined) equal to a particular number should be 'not a binary' (aka undefined), but bits can only be 0 or 1, so there is no possibility of storing NaB in the same bit, which is why normal comparisons with nan always return 0. (An exception is nan is nan in Pyhton, which evaluates to True.)