C Standard Library

C <math.h> - isgreaterequal



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

Example:

The example below shows the usage of isgreaterequal macro.

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

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

  return 0;
}

The output of the above code will be:

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

❮ C <math.h> Library