fmax
You can use thefmax
function to find out which is the larger of two real numbers.
double_t fmax (double_t x, double_t y);
x
- Any floating-point number.
y
- Any floating-point number.
DESCRIPTION
Thefmax
function determines the larger of its two arguments.if x
y
if x < yIf one of the arguments is a NaN, the other argument is returned.
EXCEPTIONS
When x and y are finite and nonzero, the result of is exact.SPECIAL CASES
Table 10-2 shows the results when one of the arguments to thefmax
function is a zero, a NaN, or an Infinity. In this table, x is a finite, nonzero floating-point number. (Note that the order of operands for this function does not matter.)
Special cases for the fmax
functionOperation Result Exceptions raised x if x > 0 None +0 if x < 0 x if x > 0 None if x < 0 +0 None x[21] None[22] + ![]()
None x None EXAMPLES
z = fmax(-INFINITY, -300,000); /* z = -300,000 because any integer is greater than */ z = fmax(NAN, -300,000); /* z = -300,000 by definition of the function fmax. */
[21] If both arguments are NaNs, the first NaN is returned.
[22] If the NaN is a signaling NaN, the invalid exception is raised.