Determine the minimum of two floating-point numbers
#include <math.h> double fmin( double x, double y ); float fminf( float x, float y ); long double fminl( long double x, long double y );
The fmin(), fminf(), and fminl() functions determine the minimum of two floating-point numbers.
To check for error situations, use feclearexcept() and fetestexcept(). For example:
The minimum of the arguments.
If: | These functions return: | Errors: |
---|---|---|
x and y are both NaN | NaN | — |
Just one of the arguments is NaN | The numeric value | — |
These functions raise FE_INEXACT if the FPU reports that the result can't be exactly represented as a floating-point number.
Safety: | |
---|---|
Cancellation point | No |
Interrupt handler | No |
Signal handler | No |
Thread | Yes |