首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

std::isfinite

Defined in header <cmath>

?

?

bool isfinite( float arg );

(1)

(since C++11)

bool isfinite( double arg );

(2)

(since C++11)

bool isfinite( long double arg );

(3)

(since C++11)

bool isfinite( Integral arg );

(4)

(since C++11)

1-3%29确定给定的浮点数arg具有有限值,即它是正规的、次正规的或零的,但不是无限的或南的。

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

参数

arg

-

floating point value

返回值

true值若arg有一定的价值,false如果arg是无限的还是南的。

实例

二次

代码语言:javascript
复制
#include <iostream>
#include <cmath>
#include <cfloat>
 
int main()
{
    std::cout << std::boolalpha
              << "isfinite(NaN) = " << std::isfinite(NAN) << '\n'
              << "isfinite(Inf) = " << std::isfinite(INFINITY) << '\n'
              << "isfinite(0.0) = " << std::isfinite(0.0) << '\n'
              << "isfinite(exp(800)) = " << std::isfinite(std::exp(800)) << '\n'
              << "isfinite(DBL_MIN/2.0) = " << std::isfinite(DBL_MIN/2.0) << '\n';
}

二次

产出:

二次

代码语言:javascript
复制
isfinite(NaN) = false
isfinite(Inf) = false
isfinite(0.0) = true
isfinite(exp(800)) = false
isfinite(DBL_MIN/2.0) = true

二次

另见

fpclassify (C++11)

categorizes the given floating point value (function)

isinf (C++11)

checks if the given number is infinite (function)

isnan (C++11)

checks if the given number is NaN (function)

isnormal (C++11)

checks if the given number is normal (function)

c关于isfinite的文献

代码语言:txt
复制
 ? cppreference.com

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

扫码关注腾讯云开发者

领取腾讯云代金券

http://www.vxiaotou.com