islessequal Macro

Determines if its first argument is smaller than or equal to its second.

Include

<math.h>

Prototype

int islessequal(floating-point x, floating-point y);

Argument

x
any floating-point number
y
any floating-point number

Return Value

Determines if x is smaller than or equal to y, as if by the expression (x) <= (y) only without any invalid floating-point exception should the arguments be unordered (i.e. should one of them be NaN).

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 = 2.0;
  b = islessequal(x, y);
  printf("That %f is less than or equal to %f is %s\n", x, y, b ? "true" : "false");
}

Example Output

That -5.700000 is less than or equal to 2.000000 is true