Facebook Page Twitter Page LinkedIn Page
× C Tutorial C Resources

The C math fmin() function is used to return minimum number between the two arguments. If one of the arguments is NaN, then the other argument is returned.


double fmin (double x, double y);
float fminf (float x, float y);
long double fminl (long double x, long double y);


x Specify value to compare.
y Specify value to compare.

Return Value

Returns the numerically minimum value.


In the below example, fmin() function is used to find out the minimum value between the two arguments.

#include <stdio.h>
#include <math.h>
int main (){
  printf("%.1lf\n", fmin(50, 100));
  printf("%.1lf\n", fmin(5.5, 10.5));
  printf("%.1lf\n", fmin(-2, 2)); 
  printf("%.1lf\n", fmin(-3, -2));  
  return 0;

The output of the above code will be:


❮ C <math.h> Library