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
要测试的浮点值。

返回值

如果 x 是正规或次正规有限值,isfinite 宏以及 _finite_finitef 函数会返回非零值。 如果该参数为无限值或为 NaN,则它们返回 0。 C++ 内联模板函数 isfinite 的行为方式相同,但返回 truefalse

备注

isfinite 在编译为 C 时是宏,在编译为 C++ 时是内联模板函数。 _finite_finitef 函数是 Microsoft 特定函数。 _finitef 函数仅在编译 x86、ARM、或 ARM64 平台时可用。

要求

函数 必需的标头 (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