When a double is neither greater nor lesser, is it equal ?
This is assumed in some implementations like for RTL’s VarCompareValue and other function that return the result of the comparison.
In those function you can see code like
else if A = B then Result := vrEqual else if A < B then Result := vrLessThan else Result := vrGreaterThan;
However that code is incorrect when dealing with IEEE double precision floats, for special “Not a Number” values.
The specificity of NaN is that is is different from everything else [1]:
So when dealing with floats, you have to go the whole way
else if A = B then Result := vrEqual else if A < B then Result := vrLessThan else if A > B then Result := vrGreaterThan else Result := vrNotEqual;