Facebook Page Twitter Page LinkedIn Page
× C++ Standard Library C++ STL Library


The C++ <cmath> isgreaterequal() function returns true if the first argument is greater than or equal to the second argument, else returns false. If any of the arguments is NaN, the function returns false, and no FE_INVALID exception is raised but using >= operator may raise such exception.

Syntax

bool isgreaterequal (float x, float y);
bool isgreaterequal (double x, double y);
bool isgreaterequal (long double x, long double 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 below example shows the usage of isgreaterequal() function.

#include <iostream>
#include <cmath>
using namespace std;
 
int main (){
  int x = 10;
  int y = 50;
  int z = 10;

  cout<<boolalpha;
  cout<<"x >= y: "<<isgreaterequal(x, y);
  cout<<endl;
  cout<<"x >= z: "<<isgreaterequal(x, z);
  cout<<endl;
  cout<<"y >= z: "<<isgreaterequal(y, z);

  return 0;
}

The output of the above code will be:

x >= y: false
x >= z: true
y >= z: true

❮ C++ <cmath> Library