Topic 1d
Floating-point Representation
Learning Outcomes
By the end of this topic students should be able to:
- Explain how a computer stores decimal numbers in the floating-point format using [8 | 32] bits.
Learning Materials
- Readings
- Floating point representation - pp 63-66
- NOTE: There is an error on page 65. The second line of text should read "the value represented would have been -2 3/4" That is, it should be a NEGATIVE number.
- Videos
- Dr. Schafer explains how floating point values are encoded
- The additional videos mentioned in this video are provided below under "Answers & Guidance." You should only watch them after you have attempted the CFU problems from p 68.
- Dr. Schafer explains how floating point values are encoded
- Extension
- While we expect you to understand the structure of converting binary to floating point values and vice versa, we do not actually expect that you can complete the calculation itself.
- However, we found that it was beneficial to our own understanding of the structure of the encoding to play with the following tools.
- Your book describes a simplified 8-bit format.
- This tool will model this format if you set the precision to 5 and the exponent to 3
- On the website linked, you can click on the "bits" in the colored boxes to toggle them between 1 and 0 and see how the decimal value changes.
- The 8-bit described above is a simplification to help us understand the process. Computers don't ever use this format. But they do use 16, 32, and 64 bit encodings.
- You can play with this tool to explore larger encodings.
Checking for Understanding
We are mostly concerned about the following:
- Can you explain how floating point values are stored in the computer standard of 32 bits
- For each of the following terms, what does it represent, and how much of the 32 bits is allocated to this portion
- Mantissa (What does it represent? How much memory?)
- Exponent Field (What does it represent? How much memory?)
- Sign Bit
- Can you explain how floating point values are stored in the textbook example of only 8 bits
While we would not ask you do to this on a competency demo, we think that it will help your overall understanding to be able to complete:
- p68, 1-2
- Again, neither of these are directly related to a learning outcome.
- BUT, the process of attempting these problems will help you with elements of other learning outcomes.
- Do not worry if even after you try these and watch the videos below if you feel you still could not do this on your own - you won't be asked to do so.
Answers & Guidance
The answers to the CFU questions above are provided in the back of the book. The following videos explain how we would arrive at some of those answers.