共用方式為


isfinite、 、 _finite_finitef

判斷指定的浮點數值是否有限。

語法

int isfinite(
   /* floating-point */ x
); /* C-only macro */

template <class FloatingType>
inline bool isfinite(
   FloatingType x
) throw(); /* C++-only template function */

int _finite(
   double x
);

int _finitef(
   float x
); /* x64 and ARM/ARM64 only */

參數

x
要測試的浮點值。

傳回值

如果 xisfinite一般或次正規有限值,則巨集和 和 _finite _finitef 函式會傳回非零值。 如果自變數是無限或 NaN,則會傳回 0。 C++內嵌範本函 isfinite 式的運作方式相同,但會傳 true 回 或 false

備註

isfinite 是編譯為 C 時的巨集,當編譯為 C++ 時為內嵌範本函式。 和 _finitef_finite式Microsoft特定。 只有在針對 x86、ARM 或 ARM64 平台進行編譯時,才能使用 _finitef 函式。

需求

函式 必要的標頭 (C) 必要的標頭 (C++)
_finite <float.h> 或 <math.h> <float.h>、 <math.h>、 <cfloat> 或 <cmath>
isfinite, _finitef <math.h> <math.h> 或 <cmath>

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

另請參閱

數學與浮點支援
fpclassify
_fpclass, _fpclassf
isinf
isnan、 、 _isnan_isnanf
isnormal