.- .

确定浮点值是否是有限的。

语法

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为普通值、非正常值或有符号零(±0)有限值,则isfinite宏和_finite函数返回_finitef非零值。 如果参数为无限或非数字(NaN),则返回 0。 C++ 内联模板函数 isfinite 的行为方式相同,但返回 true 或 false。

备注

_finite且_finitef特定于Microsoft。

isfinite 在编译为 C 时是宏,在编译为 C++ 时是内联模板函数。

_finitef 仅在编译 x64、ARM、ARM64 或 ARM64EC 平台时可用。

要求

功能 必需的标头 (C) 必需的标头 (C++)
isfinite <math.h> <math.h> 或 <cmath>
_finite <float.h> <float.h> 或 <cfloat>
_finitef <math.h> <math.h> 或 <cmath>

有关兼容性的详细信息,请参阅 兼容性。

另请参阅

数学和浮点支持
fpclassify
%>
isinf
.- .
isnormal