C++ cmath isgreaterequal

int isgreaterequal(float x , float y);
int isgreaterequal(double x , double y);
int isgreaterequal(long double x, long double y);

The C++ <cmath> isgreaterequal macro determines if the first argument is greater than or equal to the second argument.

x -The first argument.

y -The second argument.

Return type

int -Return 1 is x>=y else 0.

Some points to note:

 i) The value of isgreaterequal(x , y) is same as (x)>=(y).The only difference between them is unlike (x) >= (y), isgreaterequal(x, y) does not raise the ‘invalid’ floating-point exception when x and y are unordered.

 ii) +∞ is treated as greater than any valid value,-∞ is treated as smaller than any valid value.

 iii) If one of the arguments is NaN,0 is always returned.

 iv) If character or int type is passed as argument the function with double as parameter type is called.

Code example

cout<< “isgreaterequal(0 , 90)=” << isgreaterequal(0 , 90) << endl;

/*Passing INFINITY */
cout<< “isgreaterequal(-INFINITY , INFINITY)=” << isgreaterequal(-INFINITY , INFINITY) << endl;

/*Passing NaN */
cout<< “isgreaterequal(NAN , 0)=” << isgreaterequal(NAN , 0) << endl;


isgreaterequal(0 , 90)= 0
isgreaterequal(-INFINITY , INFINITY)= 0
isgreaterequal(NAN , 0)= 0

Related links

->C programming isgreaterequal math.h