C++ cmath isgreater

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

The C++ <cmath> isgreater macro determines if the first argument is greater than 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 isgreater(x , y) is same as (x)>(y).The only difference between them is unlike (x) > (y), isgreater(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<< “isgreater(23 , 0)=” << isgreater(23 , 0) << endl;

/*Passing INFINITY */
cout<< “isgreater(23e50 , INFINITY)=” << isgreater(23e50 , INFINITY) << endl;

/*Passing NaN */
cout<< “isgreater(NAN , 123)=” << isgreater(NAN , 123) << endl;


isgreater(23 , 0)= 1
isgreater(23e50 , INFINITY)= 0
isgreater(NAN , 123)= 0