在线文档教程
C++
应用 | Utilities

std::numeric_limits::lowest

STD::数字[医]限制::最低

static constexpr T lowest()(since C++11)

返回由数值类型表示的最低限值。T,即有限值x以至于没有其他的有限值y何地y < x这与std::numeric_limits<T>::min()用于浮点类型。仅对有界类型有意义。

返回值

Tstd::numeric_limits::lowest()
/* non-specialized */T(
boolfalse
charCHAR_MIN
signed charSCHAR_MIN
unsigned char​0​
wchar_tWCHAR_MIN
char16_t​0​
char32_t​0​
shortSHRT_MIN
unsigned short​0​
intINT_MIN
unsigned int​0​
longLONG_MIN
unsigned long​0​
long longLLONG_MIN
unsigned long long​0​
float-FLT_MAX
double-DBL_MAX
long double-LDBL_MAX

注记

对于基本C++浮点类型,第三方浮点类型不适用于%27 s。T可能存在于std::numeric_limits<T>::lowest()!=-std::numeric_limits<T>::max()...

例外

(none)(until C++11)
noexcept specification: noexcept(since C++11)

演示浮点类型的最小、最大和最低。

二次

#include <limits> #include <iostream> int main() { std::cout << "std::numeric_limits<T>::min():\n" << "\tfloat: " << std::numeric_limits<float>::min() << " or " << std::hexfloat << std::numeric_limits<float>::min() << '\n' << "\tdouble: " << std::defaultfloat << std::numeric_limits<double>::min() << " or " << std::hexfloat << std::numeric_limits<double>::min() << '\n'; std::cout << "std::numeric_limits<T>::lowest():\n" << "\tfloat: " << std::defaultfloat << std::numeric_limits<float>::lowest() << " or " << std::hexfloat << std::numeric_limits<float>::lowest() << '\n' << "\tdouble: " << std::defaultfloat << std::numeric_limits<double>::lowest() << " or " << std::hexfloat << std::numeric_limits<double>::lowest() << '\n'; std::cout << "std::numeric_limits<T>::max():\n" << "\tfloat: " << std::defaultfloat << std::numeric_limits<float>::max() << " or " << std::hexfloat << std::numeric_limits<float>::max() << '\n' << "\tdouble: " << std::defaultfloat << std::numeric_limits<double>::max() << " or " << std::hexfloat << std::numeric_limits<double>::max() << '\n'; }

二次

产出:

二次

std::numeric_limits<T>::min(): float: 1.17549e-38 or 0x1p-126 double: 2.22507e-308 or 0x1p-1022 std::numeric_limits<T>::lowest(): float: -3.40282e+38 or -0x1.fffffep+127 double: -1.79769e+308 or -0x1.fffffffffffffp+1023 std::numeric_limits<T>::max(): float: 3.40282e+38 or 0x1.fffffep+127 double: 1.79769e+308 or 0x1.fffffffffffffp+1023

二次

另见

min staticreturns the smallest finite value of the given type (public static member function)
denorm_min staticreturns the smallest positive subnormal value of the given floating-point type (public static member function)
max staticreturns the largest finite value of the given type (public static member function)

© cppreference.com

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

http://en.cppreference.com/w/cpp/type/NUMERIC[医]限制/最低