fmax, fmaxf, fmaxl

Visual Studio 2015
 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at fmax, fmaxf, fmaxl.

Determine the larger of two specified numeric values.

double fmax(  
   double x,   
   double y  
);  
  
float fmax(  
   float x,   
   float y  
); //C++ only  
  
long double fmax(  
   long double x,   
   long double y  
); //C++ only  
  
float fmaxf(  
   float x,   
   float y  
);  
  
long double fmaxl(  
   long double x,   
   long double y  
);  
  

Parameters

[in] x
The first value to compare.

[in] y
The second value to compare.

If successful, returns the larger of x or y. The value returned is exact, and does not depend on any form of rounding.

Otherwise, may return one of the following values:

IssueReturn
x = NaNy
y = NaNx
x and y = NaNNaN

This function does not use the errors specified in _matherr.

Because C++ allows overloading, you can call overloads of fmax that take and return float and long double types. In a C program, fmax always takes and returns a double.

FunctionC headerC++ header
fmax, fmaxf, fmaxl<math.h><cmath>

For additional compatibility information, see Compatibility.

Alphabetical Function Reference
fmin, fminf, fminl

Show: