| Homework 3DetailsFor each problem make sure you clearly and neatly show all of your work!
Each problem is worth 5 points.
- Express π in 32-bit floating-point.
To be more precise, express the closest number to π that you can with 32-bit floating-point notation.
(The point of this question is to help you understand how floating-point notation works.)
- How much error is there in the 32-bit representation of π?
(The purpose of this question is to help you understand the limitations of floating-point notation.)
- What number is the closest to 0 (not including 0) that you can store with 32-bit floating point?
Express it both in scientific decimal notation and the 32-bit floating point notation. Explain clearly why it is the closest to zero that you can store.
(The purpose of this question is to help you understand completely
what the 3 parts of the floating-point representation do and what the limitations
of each are.)
Hints:
- Remember that the smallest exponent you can legally store is -126, not -127 as you might expect.
- Remember that the 1 before the decimal point is implied and not actually stored!
- We did not specify this before, but if the mantissa is all 0s, that is the representation of 0 (so the 1 is not appended to the front if the whole mantissa is 0s). Given that, what is the smallest value you can represent in the mantissa?
|