6.11.68 fmax Function

Returns the value of the larger double-precision argument.

Include

<math.h>

Prototype

double fmax(double x, double y);

Arguments

x
any double precision floating-point number
y
any double precision floating-point number

Return Value

Returns the double-precision value of the larger argument.

Example

See the notes at the beginning of this chapter or section for information on using printf() or scanf() (and other functions reading and writing the stdin or stdout streams) in the example code.

#include <math.h>
#include <stdio.h>

int main(void)
{
  double x, y, z;

  x = -5.7;
  y = 2.0;
  z = fmax(x, y);
  printf("The larger of %f and %f is %f\n\n", x, y, z);
}

Example Output

The larger of -5.700000 and 2.000000 is 2.000000