In C, isunordered() is a <math.h> comparison macro. It tells you if two floating values cannot be ordered. That almost always means at least one of them is NaN. True is non-zero; false is 0.
When a pair is unordered, relations such as greater, less, or equal do not hold in the usual way. The quiet compare macros return false in those cases and avoid raising an invalid exception.
Pass two real floating arguments. Include <math.h>. Print the result as 0 or 1. Use this check before you trust a ranking between two readings.
Syntax
Ask whether two values cannot be ordered. Start with this call.
C
isunordered(x, y);
Call
What it does
isunordered(NAN, 1.0)
Returns non-zero because NaN makes the pair unordered.
isunordered(2.0, 3.0)
Returns 0 because both values are ordered numbers.
isunordered(NAN, NAN)
Returns non-zero. Two NaNs are still unordered.
Include <math.h>. On GCC, link with -lm. If isunordered is true, macros such as isgreater and isless will return false.