Previous Page
Next Page

fmax

Determines the greater of two floating-point numbers

#include <math.h>
double fmax ( double x , double y  );
float fmaxf ( float x , float y  );
long double fmaxl ( long double x  , long double y  );

The fmax( ) functions return the value of the greater argument.

Example:

// Let big equal the second-greatest possible double value ...
const double big = nextafter( DBL_MAX, 0.0 );
// ... and small the second-least possible double value:
const double small = nextafter( DBL_MIN, 0.0 );

double a, b, c;

/* ... */

if ( fmin( fmin( a, b ), c ) <= small )
  printf( "At least one value is too small.\n" );
if ( fmax( fmax( a, b ), c ) >= big )
  printf( "At least one value is too great.\n" );

See Also

fabs( ), fmin( )


Previous Page
Next Page