What is fminl in C?
The fminl function is defined in the <tgmath.h> header file in C. It takes in two parameters of type long double: x and y. It then returns the smaller of the two numbers.
The illustration below shows how the fminl function works:
Declaration
The fminl function is defined as follows:
long double fminl( long double x, long double y );
Parameters
The fminl function takes two values of the long double type as parameters.
Return value
The fminl function returns the smaller of the two long double values.
Error handling
The fminl function returns special values for certain arguments:
| x | y | Returned Value |
|---|---|---|
valid long double |
NaN |
x |
NaN |
valid long double |
y |
NaN |
NaN |
Nan |
Example
The following code snippet shows how we can use the fminl function:
#include <stdio.h> // include header for printf#include <tgmath.h> // include header for fminlint main(){// setting values for x and ylong double x = 2.0;long double y = 4.0;long double result;result = fminl(x, y);printf("The result is: %Lf", result);return 0;}
Free Resources
Copyright ©2026 Educative, Inc. All rights reserved