Floating Point Imprecision

Audience: Beginning programming students


  1. Students will understand that floating point arithmetic differs from mathematics because it is imprecise
  2. Students will know how to find limits of floating point arithmetic
  3. Students will understand the difference between floating point and multiple precision types


Compute the largest number ε such that adding ε to 1 produces 1:

1.0 + ε == 1.0

Discussion questions

  1. Why is ε not 0?
  2. Does the value of ε change depending on the number of bits of precision in the floating point arithmetic?
  3. How do you test for equality when floating point numbers are involved?
  4. Does the value of ε vary among different machines?