CSCI 112 Spring 2024
Exploring Computer Science
Archived Class
Charles Cusack
Computer Science
Hope College
Main
Schedule
Grading
Gradebook
Homework

Policies
Advice
College
    Policies

Notes
Programs
Tutorials

CSCI 125
CSCI 255
Others

Admin

Homework 3

Details

For each problem make sure you clearly and neatly show all of your work! Each problem is worth 5 points.

  1. 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.)
  2. 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.)
  3. 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:
  1. Remember that the smallest exponent you can legally store is -126, not -127 as you might expect.
  2. Remember that the 1 before the decimal point is implied and not actually stored!
  3. 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?