Q5. Explain floating point types offered by C++ along with the minimal ranges and digit of precision they support.
Ans. C++ has three floating-point types: float, double and long double. These types are described in terms of the number of significant figures they can represent and the minimum allowable range of exponents.
Type float occupies 4 bytes of memory. Type double occupies 8 bytes, twice as much memory as type float and stores floating-point numbers with much larger range and precision. Floating-point type Long double occupies 10 bytes and has only slightly greater range and precision than type double.
|Types||Approximate Size (in bytes)||Minimal Range||Digits of Precision|
|Float||4||3.4 x 10-38 to 3.4 X 1038 -1||7|
|Double||8||1.7 X 10-308 to 1.7 X 10308 -1||15|
|long double||10||3.4 X 10 -4932 to 1.1 X 10 4932 -1||19|