isunordered - C math.h

C examples for math.h:isunordered

type

macro

From

<cmath>
<ctgmath>
<math.h>

Description

Returns whether x or y are unordered values:

If one or both arguments are NaN, the arguments are unordered and the function returns true.

Prototype

bool isunordered (float x      , float y);
bool isunordered (double x     , double y);
bool isunordered (long double x, long double y);
     isunordered(x,y)

Parameters

Parameter Description
x Values to check whether they are unordered.
y Values to check whether they are unordered.

Return value

true (1) if either x or y is NaN. false (0) otherwise.

Example

Demo Code


#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;
}

Related Tutorials