-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathnumeric_limits.cpp
20 lines (20 loc) · 1.25 KB
/
numeric_limits.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <limits>
#include <cstddef>
#include <iostream>
int main()
{
std::cout << "short: " << std::dec << std::numeric_limits<short>::max()
<< " or " << std::hex << std::showbase << std::numeric_limits<short>::max() << '\n'
<< "int: " << std::dec << std::numeric_limits<int>::max()
<< " or " << std::hex << std::numeric_limits<int>::max() << '\n' << std::dec
<< "streamsize: " << std::dec << std::numeric_limits<std::streamsize>::max()
<< " or " << std::hex << std::numeric_limits<std::streamsize>::max() << '\n'
<< "size_t: " << std::dec << std::numeric_limits<std::size_t>::max()
<< " or " << std::hex << std::numeric_limits<std::size_t>::max() << '\n'
<< "float: " << std::numeric_limits<float>::max()
<< " or " << std::hexfloat << std::numeric_limits<float>::max() << '\n'
<< "double: " << std::defaultfloat << std::numeric_limits<double>::max()
<< " or " << std::hexfloat << std::numeric_limits<double>::max() << '\n'
<< "long double: " << std::defaultfloat << std::numeric_limits<long double>::max()
<< " or " << std::hexfloat << std::numeric_limits<long double>::max() << '\n';
}