Floating Point Types
Objectives
We would like to :
- Discuss floats.
Notes
- float, double, long double
- All stored in IEEE 754 format
- $+/-1.dddd x 2^{eeee}$
- the number of d's and e's depend on the size.
- Some $+/-0.00ddd x 2^{-abc}$
- In this case, abc is determined by the format
- -126 for floats
- -16382 for long doubles
- has inf, -inf and nan
- IO manip
- reference
- showpoint/noshowpont
- fixed/scientific/defaultfloat
- setprecision(n) (fixed first)
- casts
- (type) express // c style
- type(expression) // c++ style old
- (type)(expression) // better
- static_cast< type>(expression) new style
- constant_cast
- dynamic_cast
- reinterpret_cast
- Don't forget cmath