C programming isunordered math.h


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

In C programming <math.h> isunordered determines if the first argument is less than or greater than the second argument.

Parameters:
x -The first argument.

y -The second argument.

Return type
int -Return 1 if the arguments are unordered.

Some points to note:

 i) The function return 1 if one of the arguments is NAN.

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

Code example

double dx = 10 , dy = 10 ,
x1 = 2.1e20 , x2=2.2e20 ;

float fx = 11 , fy = 10 ;

long double ldx = 10 , ldy = 11 ;

printf(“%i”, islessgreater( dx , dy) ) ; //calls the 2nd version
printf(“\n%i”, islessgreater( fx , fy) ) ; //calls the 1st version
printf(“\n%i”, islessgreater( ldx , ldy) ) ;//calls the 3rd version

printf(“\n%i”, islessgreater( x1 , x2) ) ;
printf(“\n%i”, islessgreater( NAN , INFINITY) ) ;

Output in Visual Studio,

0
0
0
0
1

Link : C nan:myths and conception


Related links

->C islessequal math.h

->C isgreaterequal math.h

->C islessgreater math.h