C Standard Library

C <math.h> - isless



The C <math.h> isless macro returns true if the first argument is less than 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 isless (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 the second argument, else returns false (0).

Example:

The example below shows the usage of isless macro.

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

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

  return 0;
}

The output of the above code will be:

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

❮ C <math.h> Library