在线文档教程
C++
数字 | Numerics

std::isinf

STD::ISINF

Defined in header
bool isinf( float arg (1)(since C++11)
bool isinf( double arg (2)(since C++11)
bool isinf( long double arg (3)(since C++11)
bool isinf( Integral arg (4)(since C++11)

1-3%29确定给定的浮点数arg是一个正的或负的无穷大。

4%29一组重载或接受from任何论点积分型等效于%282%29%28的参数转换为double29%。

参数

arg-floating point value

返回值

true如果arg是无限的,false否则。

二次

#include <iostream> #include <cmath> #include <cfloat> int main() { std::cout << std::boolalpha << "isinf(NaN) = " << std::isinf(NAN) << '\n' << "isinf(Inf) = " << std::isinf(INFINITY) << '\n' << "isinf(0.0) = " << std::isinf(0.0) << '\n' << "isinf(exp(800)) = " << std::isinf(std::exp(800)) << '\n' << "isinf(DBL_MIN/2.0) = " << std::isinf(DBL_MIN/2.0) << '\n'; }

二次

产出:

二次

isinf(NaN) = false isinf(Inf) = true isinf(0.0) = false isinf(exp(800)) = true isinf(DBL_MIN/2.0) = false

二次

另见

fpclassify (C++11)categorizes the given floating point value (function)
isfinite (C++11)checks if the given number has finite value (function)
isnan (C++11)checks if the given number is NaN (function)
isnormal (C++11)checks if the given number is normal (function)

c ISINF文件

© cppreference.com

在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。

http://en.cppreference.com/w/cpp/数值/数学/isinf