long double
, fmaxl
is called. Otherwise, if any argument has integer type or has type double
, fmax
is called. Otherwise, fmaxf
is called.x, y | - | floating point values |
If successful, returns the larger of two floating point values. The value returned is exact and does not depend on any rounding modes.
This function is not subject to any of the error conditions specified in math_errhandling
.
If the implementation supports IEEE floating-point arithmetic (IEC 60559),
This function is not required to be sensitive to the sign of zero, although some implementations additionally enforce that if one argument is +0 and the other is -0, then +0 is returned.
#include <stdio.h> #include <math.h> int main(void) { printf("fmax(2,1) = %f\n", fmax(2,1)); printf("fmax(-Inf,0) = %f\n", fmax(-INFINITY,0)); printf("fmax(NaN,-1) = %f\n", fmax(NAN,-1)); }
Output:
(C99) | checks if the first floating-point argument is greater than the second (function macro) |
(C99)(C99)(C99) | determines smaller of two floating-point values (function) |
C++ documentation for fmax |
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
https://en.cppreference.com/w/c/numeric/math/fmax