C Standard Library

C <math.h> - isgreater



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

Example:

The example below shows the usage of isgreater macro.

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

  printf("x > y: %i\n", isgreater(x, y));
  printf("x > z: %i\n", isgreater(x, z));
  printf("y > z: %i\n", isgreater(y, z));

  return 0;
}

The output of the above code will be:

x > y: 0
x > z: 0
y > z: 1

❮ C <math.h> Library