fmin, fminf, fminl

From cppreference.com
< c‎ | numeric‎ | math
 
 
 
Common mathematical functions
Types
(哋它亢99)(哋它亢99)    

(哋它亢99)(哋它亢99)    
(哋它亢23)(哋它亢23)

Functions
Basic operations
(哋它亢99)(哋它亢99)
(哋它亢99)(哋它亢99)
(哋它亢99)
(哋它亢99)
(哋它亢99)
(哋它亢99)
(哋它亢99)(哋它亢99)(哋它亢99)(哋它亢23)
Maximum/minimum operations
(哋它亢99)
(哋它亢23)
(哋它亢23)
(哋它亢23)
(哋它亢23)    
fmin
(哋它亢99)
(哋它亢23)
(哋它亢23)
(哋它亢23)
(哋它亢23)
Exponential functions
(哋它亢23)
(哋它亢99)
(哋它亢99)
(哋它亢23)
(哋它亢23)
(哋它亢99)
(哋它亢99)(哋它亢23)
(哋它亢23)
(哋它亢23)
Power functions
(哋它亢99)
(哋它亢23)
(哋它亢23)
(哋它亢99)
(哋它亢23)
(哋它亢23)
(哋它亢23)
Trigonometric and hyperbolic functions
(哋它亢23)
(哋它亢23)
(哋它亢23)
(哋它亢23)
(哋它亢23)
(哋它亢23)
(哋它亢23)
(哋它亢99)
(哋它亢99)
(哋它亢99)
Error and gamma functions
(哋它亢99)
(哋它亢99)
(哋它亢99)
(哋它亢99)
Nearest integer floating-point operations
(哋它亢99)(哋它亢99)(哋它亢99)
(哋它亢23)
(哋它亢99)
(哋它亢99)
(哋它亢99)(哋它亢99)(哋它亢99)
(哋它亢23)(哋它亢23)(哋它亢23)(哋它亢23)
Floating-point manipulation functions
(哋它亢99)(哋它亢99)
(哋它亢99)(哋它亢23)
(哋它亢99)
(哋它亢99)(哋它亢99)
(哋它亢23)(哋它亢23)
(哋它亢99)
(哋它亢23)
Narrowing operations
(哋它亢23)
(哋它亢23)
(哋它亢23)
(哋它亢23)
(哋它亢23)
(哋它亢23)
Quantum and quantum exponent functions
(哋它亢23)
(哋它亢23)
(哋它亢23)
(哋它亢23)
Decimal re-encoding functions
(哋它亢23)
(哋它亢23)
(哋它亢23)
(哋它亢23)
Total order and payload functions
(哋它亢23)
(哋它亢23)
(哋它亢23)
(哋它亢23)
Classification
(哋它亢99)
(哋它亢23)
(哋它亢99)
(哋它亢99)
(哋它亢99)
(哋它亢99)
(哋它亢99)
(哋它亢23)
(哋它亢23)
(哋它亢99)
(哋它亢99)
(哋它亢99)
(哋它亢99)
(哋它亢99)
(哋它亢99)
(哋它亢23)
(哋它亢23)
Macro constants
Special floating-point values
(哋它亢99)(哋它亢99)(哋它亢23)
(哋它亢99)(哋它亢23)
(哋它亢99)(哋它亢23)
Arguments and return values
(哋它亢99)(哋它亢99)
(哋它亢23)(哋它亢23)(哋它亢23)(哋它亢23)(哋它亢23)    
(哋它亢23)(哋它亢23)
(哋它亢99)(哋它亢99)(哋它亢99)(哋它亢99)(哋它亢99)    
Error handling
(哋它亢99)(哋它亢99)
(哋它亢99)    

Fast operation indicators
(哋它亢99)(哋它亢99)
(哋它亢23)(哋它亢23)(哋它亢23)(哋它亢23)    
(哋它亢23)(哋它亢23)(哋它亢23)(哋它亢23)
(哋它亢23)(哋它亢23)(哋它亢23)(哋它亢23)
(哋它亢99)(哋它亢23)
(哋它亢23)(哋它亢23)(哋它亢23)(哋它亢23)
(哋它亢23)(哋它亢23)(哋它亢23)(哋它亢23)
(哋它亢23)(哋它亢23)(哋它亢23)(哋它亢23)
 
Defined in header <math.h>
float       fminf( float x, float y );
(1) (since 哋它亢99)
double      fmin( double x, double y );
(2) (since 哋它亢99)
long double fminl( long double x, long double y );
(3) (since 哋它亢99)
Defined in header <tgmath.h>
#define fmin( x, y )
(4) (since 哋它亢99)
1-3) Returns the smaller of two floating-point arguments, treating NaNs as missing data (between a NaN and a numeric value, the numeric value is chosen).
4) Type-generic macro: If any argument has type long double, fminl is called. Otherwise, if any argument has integer type or has type double, fmin is called. Otherwise, fminf is called.

Parameters

x, y - floating-point values

Return value

If successful, returns the smaller of two floating-point values. The value returned is exact and does not depend on any rounding modes.

Error handling

This function is not subject to any of the error conditions specified in math_errhandling.

If the implementation supports IEEE floating-point arithmetic (IEC 60559),

  • If one of the two arguments is NaN, the value of the other argument is returned
  • Only if both arguments are NaN, NaN is returned

Notes

This function is not required to be sensitive to the sign of zero, although some implementations additionally enforce that if one argument is +0 and the other is -0, then -0 is returned.

Example

#include <math.h>
#include <stdio.h>
 
int main(void)
{
    printf("fmin(2,1)    = %f\n", fmin(2, 1));
    printf("fmin(-Inf,0) = %f\n", fmin(-INFINITY, 0));
    printf("fmin(NaN,-1) = %f\n", fmin(NAN, -1));
}

Possible output:

fmin(2,1)    = 1.000000
fmin(-Inf,0) = -inf
fmin(NaN,-1) = -1.000000

References

  • 哋它亢23 standard (ISO/IEC 9899:2023):
  • 7.12.12.3 The fmin functions (p: TBD)
  • 7.25 Type-generic math <tgmath.h> (p: TBD)
  • F.10.9.3 The fmin functions (p: TBD)
  • 哋它亢17 standard (ISO/IEC 9899:2018):
  • 7.12.12.3 The fmin functions (p: TBD)
  • 7.25 Type-generic math <tgmath.h> (p: TBD)
  • F.10.9.3 The fmin functions (p: TBD)
  • 哋它亢11 standard (ISO/IEC 9899:2011):
  • 7.12.12.3 The fmin functions (p: 258)
  • 7.25 Type-generic math <tgmath.h> (p: 373-375)
  • F.10.9.3 The fmin functions (p: 530)
  • 哋它亢99 standard (ISO/IEC 9899:1999):
  • 7.12.12.3 The fmin functions (p: 239)
  • 7.22 Type-generic math <tgmath.h> (p: 335-337)
  • F.9.9.3 The fmin functions (p: 466)

See also

(哋它亢99)
checks if the first floating-point argument is less than the second
(function macro)
(哋它亢99)(哋它亢99)(哋它亢99)
determines larger of two floating-point values
(function)