Floating point/Lesson Five
When an error is created in the computer, we have to understand how error is propagated and whether we can trust an answer. Additionally, it is good to know where problems can occur.
Operations
[edit | edit source]Two types of error can occur in normal mathematical operations ( +, -, ×, and ÷ ) in floating point arithmetic. The first is called a benign error. Benign errors are roundoff errors that occur when the exact quantities are known and in one step, there is an error. Catastrophic error, on the other hand, results when unknown quantities are put through a mathematical operator and the result becomes extraordinarily wrong. For two numbers a and b, this can happen in addition and subtraction in the following ways:
1. a - b if a - b ≈ 0
2. a + b if a is much larger than b
Demonstration:
1.xxxxxxxxxx 1.xxxxxxxxxx (other decimals) + 0.0yyyyyyyy - 1.xxxxxxxxxx (other decimals) ------------------------- --------------------------------- 1.xxxxxxxxxx 0.0000000000 (the decimals of y are missing) (all decimals are missing)
Rounding
[edit | edit source]The IEEE standard does not operate in a similar manner to the way that was described in the section. In reality, when a number is calculated an interval is placed around the number, [x, y]. This interval is then processed as a calculation and all subsequent calculations are processed on this interval. If one machine number is left in the final interval, the computer selects that number. Otherwise, it needs more precision and uses it.
Sources
[edit | edit source]UIUC, CS 257 Lecture Notes Spring 2008 http://docs.sun.com/source/806-3568/ncg_goldberg.html