6.11.72 fminf Function

Returns the value of the smaller single-precision argument.

Include

<math.h>

Prototype

float fminf(float x, float y);

Arguments

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

Return Value

Returns the single-precision value of the smaller 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)
{
  float x, y, z;

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

Example Output

The smaller of -5.700000 and 2.000000 is -5.700000