[std::numeric_limits]
먼저 기능들은 헤더
레퍼런스에 나와있는 에제 코드이다.
#include <limits>
#include <iostream>
int main()
{
std::cout
<< "type\t│ lowest()\t│ min()\t\t│ max()\n"
<< "bool\t│ "
<< std::numeric_limits<bool>::lowest() << "\t\t│ "
<< std::numeric_limits<bool>::min() << "\t\t│ "
<< std::numeric_limits<bool>::max() << '\n'
<< "uchar\t│ "
<< +std::numeric_limits<unsigned char>::lowest() << "\t\t│ "
<< +std::numeric_limits<unsigned char>::min() << "\t\t│ "
<< +std::numeric_limits<unsigned char>::max() << '\n'
<< "int\t│ "
<< std::numeric_limits<int>::lowest() << "\t│ "
<< std::numeric_limits<int>::min() << "\t│ "
<< std::numeric_limits<int>::max() << '\n'
<< "float\t│ "
<< std::numeric_limits<float>::lowest() << "\t│ "
<< std::numeric_limits<float>::min() << "\t│ "
<< std::numeric_limits<float>::max() << '\n'
<< "double\t│ "
<< std::numeric_limits<double>::lowest() << "\t│ "
<< std::numeric_limits<double>::min() << "\t│ "
<< std::numeric_limits<double>::max() << '\n';
}
possible outputs:
type │ lowest() │ min() │ max()
bool │ 0 │ 0 │ 1
uchar │ 0 │ 0 │ 255
int │ -2147483648 │ -2147483648 │ 2147483647
float │ -3.40282e+38 │ 1.17549e-38 │ 3.40282e+38
double │ -1.79769e+308 │ 2.22507e-308 │ 1.79769e+308
자세한 내용은 아래의 레퍼런스 참조 하세용
click reference site
Comments