In C, fminimum_num() returns the smaller of two double values. fminimum_num(8.0, 2.0) is 2.0. Negative zero is less than positive zero.
If exactly one argument is NaN, the function returns the other number. You get NaN only when both are NaN. This is C23-style math in <math.h>, so a newer C library may be required. Behavior is close to classic fmin().
Syntax
Pass two floating-point numbers. Start with this call.
C
fminimum_num(8.0, 2.0);
Call
What it does
fminimum_num(8.0, 2.0)
Returns 2.0, the smaller value.
fminimum_num(NAN, 5.0)
Prefers the number and returns 5.0.
Include <math.h>. On GCC, link with -lm. Needs C23 support. For NaN propagation, use fminimum() instead.
Library declarations
C
double fminimum_num(double x, double y);
float fminimum_numf(float x, float y);
long double fminimum_numl(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. If one is NaN, returns the other. NaN only if both are NaN.