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

std::isnormal

性病::正常

Defined in header
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。

http://en.cpPreference.com/w/cpp/数值/数学/isNormal