C Standard Library

C <math.h> - islessequal



The C <math.h> islessequal macro returns true if the first argument is less than or equal to the second argument, else returns false. The type of both arguments should be float, double or long double. If any of the arguments is NaN, it returns false, and no FE_INVALID exception is raised but using <= operator may raise such exception.

Syntax

bool islessequal (x, y);                

Parameters

x Specify first value to be compared.
y Specify second value to be compared.

Return Value

Returns true (1) if the first argument is less than or equal to the second argument, else returns false (0).

Example:

The example below shows the usage of islessequal macro.

#include <stdio.h>
#include <math.h>
 
int main (){
  float x = 10;
  float y = 50;
  float z = 10;

  printf("x <= y: %i\n", islessequal(x, y));
  printf("x <= z: %i\n", islessequal(x, z));
  printf("y <= z: %i\n", islessequal(y, z));

  return 0;
}

The output of the above code will be:

x <= y: 1
x <= z: 1
y <= z: 0

❮ C <math.h> Library