Description
Execute the following lines in a Python interpreter.
-
x = 9.4
-
y = x – 9
-
z = y – 0.4
-
print(z)
What did you get for z? What should it be in exact arithmetic? Why is it not what it should be?
See Sauer’s Numerical Analysis Chapter 0.3.3 for a complete description of the rounding phenomenon.
1