A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://cplusplus.com/reference/cmath/isunordered/ below:

macro

<cmath> <ctgmath>

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

Is unordered

Returns whether x or y are unordered values:

If one or both arguments are NaN, the arguments are unordered and the function returns true. In no case the function raises a FE_INVALID exception.

In C, this is implemented as a macro that returns an int value. The type of both x and y shall be float, double or long double.

In C++, it is implemented with function overloads for each

floating-point type

, each returning a

bool

value.



Parameters
x, y
Values to check whether they are unordered.

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

Example
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/* isunordered example */
#include <stdio.h>      /* printf */
#include <math.h>       /* isunordered, sqrt */

int main ()
{
  double result;
  result = sqrt (-1.0);

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

Output:
sqrt(-1.0) and 0.0 cannot be ordered


See also
isgreater
Is greater (macro)
isgreaterequal
Is greater or equal (macro)
isless
Is less (macro)
islessgreater
Is less or greater (macro)
isunordered
Is unordered (macro)

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4