C examples for math.h:isunordered
macro
<cmath> <ctgmath> <math.h>
Returns whether x or y are unordered values:
If one or both arguments are NaN, the arguments are unordered and the function returns true.
bool isunordered (float x , float y); bool isunordered (double x , double y); bool isunordered (long double x, long double y); isunordered(x,y)
Parameter | Description |
---|---|
x | Values to check whether they are unordered. |
y | Values to check whether they are unordered. |
true (1) if either x or y is NaN. false (0) otherwise.
#include <stdio.h> #include <math.h> int main ()//from w w w .java 2 s . c om { double result = sqrt (-1.0); if (isunordered(2,0.0)) printf ("2 and 0.0 cannot be ordered\n"); else printf ("2 and 0.0 can be ordered\n"); if (isunordered(result,0.0)) printf ("sqrt(-1.0) and 0.0 cannot be ordered"); else printf ("sqrt(-1.0) and 0.0 can be ordered"); return 0; }