In C, fminimum() returns the smaller of two double values by numeric order. fminimum(8.0, 2.0) is 2.0. Negative zero is treated as less than positive zero.
If either argument is NaN, the result is NaN. That is the main difference from classic fmin(). This is a C23-style function in <math.h>, so you may need a newer C library.
Syntax
Pass two floating-point numbers. Start with this call.
C
fminimum(8.0, 2.0);
Call
What it does
fminimum(8.0, 2.0)
Returns 2.0, the smaller value.
fminimum(1.0, NAN)
Returns NaN because one argument is NaN.
Include <math.h>. On GCC, link with -lm. Needs C23 math support. Prefer fmin() if you want the older “skip NaN” behavior.
Library declarations
C
double fminimum(double x, double y);
float fminimumf(float x, float y);
long double fminimuml(long double x, long double y);
Parameters
Parameter
Description
x
Required. First floating-point value.
y
Required. Second floating-point value.
Return Value
Return Value
Description
double
The smaller argument, or NaN if either argument is NaN.