Next: Polynomial evaluation
Up: October lecture summary
Previous: October lecture summary
October 2
Course Readings, 14,15, 199-218
Last time we discussed catastrophic cancellation error when
subtracting two relatively close numbers. This error can come up in a
couple of ways. Suppose you decide to evaluate
using the
series:
Notice that the later terms in this series get very small, and so does
the entire series. Once you get past the first dozen terms you are
repeatedly subtracting very small values (odd terms like
)
from the partial sum, which is itself small. This gives repeated
cancellation error.
Similarly, whenever you compare two floating point numbers for
equality, you are vulnerable to cancellation error:
The line above is certainly an equation, but the floating-point
representations of
and
may be close but different.
Subsections
Danny Heap
2002-12-16