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
The over-simplified answer is that a NaN has no numeric value, so there is nothing in it to compare to anything else.
You might consider testing for and replacing your NaNs with +INF if you want them to act like +INF.