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

Determines if its arguments are unordered (i.e. one of them is NaN) and returns 1 is they are unordered and 0 is they are not.

Example

#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