Data type ranges (order of magnitude)
CPP file, prints data ranges for different data types.
Compile with
g++ Printlimits.cpp -o Printlimits -lm
Integers
Found in /usr/include/limits.h
Source
| Bits | range signed | Unsigned |
| 8 | -128 to +127 | 0 to +255 |
| 16 | -32.768 to +32.767 | 0 to +65.535 |
| 32 | -2,14e9 to +2,14e9 | 0 to +4,3e9 |
| 64 | -9,22e18 to +9,22e18 | 0 to +18,44e18 |
Floating types
On Ubuntu (64 bit) float.h is located in /usr/lib/gcc/x86_64-linux-gnu/4.2/include
Useful functions:
- std::numeric_limits::max()
- std::numeric_limits::max()
| Type | Min | Max | epsilon |
| Float | 1.17549e-38 | 3.40282e+38 | 1.19209e-07 |
| Double | 2.22507e-308 | 1.79769e+308 | 2.22045e-16 |