Share via


fmin, fminf, fminl

決定兩個指定值的較小者。

語法

double fmin(
   double x,
   double y
);

float fmin(
   float x,
   float y
); //C++ only

long double fmin(
   long double x,
   long double y
); //C++ only

float fminf(
   float x,
   float y
);

long double fminl(
   long double x,
   long double y
);

#define fmin(x) // Requires C11 or higher

參數

x
要比較的第一個值。

y
要比較的第二個 值。

傳回值

如果成功,會傳回 xy 的較小者。

輸入 結果
x 是 NaN y
y 是 NaN x
xy 是 NaN NaN

此函式不會叫 _matherr 用、造成任何浮點例外狀況,或變更 的值 errno

備註

因為 C++ 允許多載,所以您可以呼叫採用並傳回 fminfloat 類型的 long double 的多載。 在 C 程式中,除非您使用 < tgmath.h > 宏來呼叫此函式, fmin 否則一律會採用 並傳 double 回 。

如果您使用 < tgmath.h >fmin() 宏,引數的類型會決定選取哪一個函式版本。 如需詳細資訊,請參閱 類型泛型數學

需求

常式 必要的標頭
fmin, fminf, fminl C: < math.h>
C++: < math.h > 或 < cmath>
fmin 宏觀 <tgmath.h>

如需相容性詳細資訊,請參閱相容性

另請參閱

字母函數參考
fmax, fmaxf, fmaxl