Why do comparisons of NaN values behave differently from all other values? That is, all comparisons with the operators ==, <=, >=, <, > where one or both values is NaN
I'm guessing that NaN (Not A Number) means exactly that: This is not a number and thus comparing it does not really make sense.
It's a bit like arithmetic in SQL with null
operands: They all result in null
.
The comparisons for floating point numbers compare numeric values. Thus, they can't be used for non numeric values. NaN therefore cannot be compared in a numeric sense.