Udostępnij za pośrednictwem


fmax, fmaxf, fmaxl

 

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.

Syntax

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.

Return Value

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:

Issue Return
x = NaN y
y = NaN x
x and y = NaN NaN

This function does not use the errors specified in _matherr.

Remarks

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.

Requirements

Function C header C++ header
fmax, fmaxf, fmaxl <math.h> <cmath>

For additional compatibility information, see Compatibility.

See Also

Alphabetical Function Reference
fmin, fminf, fminl