December 2005
Beginner to intermediate
618 pages
20h 19m
English
fmax
Determines the greater of two floating-point numbers
#include <math.h> doublefmax( doublex, doubley); floatfmaxf( floatx, floaty); long doublefmaxl( long doublex, long doubley);
The fmax() functions return
the value of the greater argument.
// 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" );
Read now
Unlock full access