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

std::isnormal

Defined in header <cmath>

bool isnormal( float arg );

(1)

(since C++11)

bool isnormal( double arg );

(2)

(since C++11)

bool isnormal( long double arg );

(3)

(since C++11)

bool isnormal( Integral arg );

(4)

(since C++11)

1-3%29确定给定的浮点数arg是正规的,即不是零,次正规,无限,也不是南。

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

参数

arg

-

floating point value

返回值

true如果arg是正常的,false否则。

二次

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

二次

产出:

二次

代码语言:javascript
复制
isnormal(NaN) = false
isnormal(Inf) = false
isnormal(0.0) = false
isnormal(DBL_MIN/2.0) = false
isnormal(1.0) = true

二次

另见

fpclassify (C++11)

categorizes the given floating point value (function)

isfinite (C++11)

checks if the given number has finite value (function)

isinf (C++11)

checks if the given number is infinite (function)

isnan (C++11)

checks if the given number is NaN (function)

c文件为等距

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

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

扫码关注腾讯云开发者

领取腾讯云代金券