C <math.h> - islessgreater
The C <math.h> islessgreater macro returns true if the first argument is less than or 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 (x<y||x>y) may raise such exception.
Syntax
bool islessgreater (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 less than or greater than the second argument, else returns false (0).
Example:
The example below shows the usage of islessgreater macro.
#include <stdio.h> #include <math.h> int main (){ float x = 10; float y = 50; float z = 10; printf("(x < y OR x > y): %i\n", islessgreater(x, y)); printf("(x < z OR x > z): %i\n", islessgreater(x, z)); printf("(y < z OR y > z): %i\n", islessgreater(y, z)); return 0; }
The output of the above code will be:
(x < y OR x > y): 1 (x < z OR x > z): 0 (y < z OR y > z): 1
❮ C <math.h> Library