C Data Type Functions - C islessgreater






Prototype C99

The C99 prototype is listed as follows.

 
          macro islessgreater(x,y) 
         

Prototype C++11

The C++11 prototype is listed as follows.

bool islessgreater (float x      , float y);
bool islessgreater (double x     , double y);
bool islessgreater (long double x, long double y); 
         

Returns whether x is less than or greater than y.

Parameter

This function has the following parameter.

x, y
Values to be compared.

Return

The same as (x)<(y)||(x)>(y): true (1) if x is less than or greater than y. false ( 0) otherwise.

Example


#include <stdio.h> /* printf */
#include <math.h> /* islessgreater, log */
/*w  w  w  . j a  v  a 2 s.  c  o  m*/
int main (){
  double result;
  result = log (10.0);

  if (islessgreater(result,0.0))
    printf ("log(10.0) is not zero");
  else
    printf ("log(10.0) is zero");

  return 0;
} 

       

The code above generates the following result.





Example 2


#include <stdio.h>
#include <math.h>
 /*  w  w w  .  j a  va2  s  . c  o  m*/
int main(void)
{
    printf("islessgreater(2.0,1.0)      = %d\n", islessgreater(2.0,1.0));
    printf("islessgreater(1.0,2.0)      = %d\n", islessgreater(1.0,2.0));
    printf("islessgreater(1.0,1.0)      = %d\n", islessgreater(1.0,1.0));
    printf("islessgreater(INFINITY,1.0) = %d\n", islessgreater(INFINITY,1.0));
    printf("islessgreater(1.0,NAN)      = %d\n", islessgreater(1.0,NAN));
 
    return 0;
}

The code above generates the following result.