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否则。
例
二次
#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';
}二次
产出:
二次
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文件为等距
© cppreference.com在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。
本文档系腾讯云开发者社区成员共同维护,如有问题请联系 cloudcommunity@tencent.com

