6.11.96 isunordered Macro
Determines if its arguments are unordered.
Include
<math.h>
Prototype
int isunordered(floating-point x, floating-point
y);
Arguments
x
- any floating-point number
y
- any floating-point number
Return Value
Returns 1 if its arguments are unordered (i.e. one or both of them are NaN) or 0 if they are not.
Example
See the notes at the beginning of this chapter or section for
information on using printf()
or scanf()
(and other functions reading and writing the stdin
or
stdout
streams) in the example code.
#include <math.h>
#include <stdio.h>
int main(void)
{
double x, y;
int b;
x = -5.7;
y = nan(NULL);
b = isunordered(x, y);
printf("The arguments %f and %f are %s\n\n", x, y, b ? "unordered" : "ordered");
}
Example Output
The arguments -5.700000 and nan are unordered