Unordered Comparisons

Floating point comparisons are mapped to C operators: ==, <, >=, etc. In the case of non-compliant libraries, all comparisons are considered ordered, which means comparisons with NaN have undefined results. Compliant libraries support unordered comparisons, which have the added functionality of returning false for every comparison which involves a NaN, except "not equal". In order to enable unordered comparisons, the "fp_compliant" option needs to be passed to the compiler. The following table better illustrates unordered comparisons:

Table 1. Unordered Comparison
    == != > < >= <=
f NaN False True False False False False
NaN f False True False False False False
NaN NaN False True False False False False