Redirected from Catastrophic loss of significance
In floatingpoint arithmetic, only a small number of digits of the number are maintained; floatingpoint numbers can only approximate most real numbers.
Consider the real number
.1234567891234567890 .
A floatingpoint representation of this number on a machine that keeps 10 floatingpoint digits would be
.1234567891,
which seems pretty closethe difference is very small in comparison with either of the two numbers.
Now perform the calculation
.1234567891234567890  .1234567890 .
The real answer, accurate to 10 digits, is
.0000000001234567890
But on the 10digit floatingpoint machine, the calculation yields
.1234567891  .1234567890 = .0000000001 .
Whereas the original numbers are accurate in all of the first (most significant) 10 digits, their floatingpoint difference is only accurate in its first digit. This amounts to loss of information.
It is possible to do all rational arithmetic keeping all significant digits, but to do so is often prohibitively slower than floatingpoint arithmetic. Furthermore, it usually only postpones the problem: What if the data is accurate to only 10 digits? The same effect will occur.
One of the most crucial parts of numerical analysis is to avoid or minimize loss of significance in calculations. If the underlying problem is wellposed, there should be a stable algorithm[?] for solving it. The art is in finding a stable algorithm.
Instability of the quadratic formula
For example, consider the venerable quadratic formula for solving a quadratic equation
<math>a x^2 + b x + c = 0</math> .
The quadratic formula gives the two solutions as
The case <math>a = 1</math>, <math>b = 200</math>, <math>c = 0.000015</math> will serve to illustrate the problem:
<math>x^2 + 200 x  0.000015 = 0</math> .
We have
<math>\sqrt{b^2  4 a c} = \sqrt{200^2 + 4 \times 1 \times 0.000015} = 200.00000015...</math>
In real arithmetic, the roots are
<math>( 200  200.00000015 ) / 2 = 200.000000075</math> ,
<math>( 200 + 200.00000015 ) / 2 = .000000075</math> .
In 10digit floatingpoint arithmetic,
<math>( 200  200.0000001 ) / 2 = 200.00000005</math> ,
<math>( 200 + 200.0000001 ) / 2 = .00000005</math> .
Notice that the bigger solution is accurate to ten digits, but the first nonzero digit of the smaller solution is wrong.
Because of the subtraction that occurs in the quadratic formula, it does not constitute a stable algorithm to calculate the two roots of a quadratic equation.
A better algorithm for solving quadratic equations is based on the observations that one solution is always accurate when the other is not, and that given one solution of the quadratic, the other is easy to find.
If
and
then we have the identity
<math>x_1 x_2 = c / a</math> .
The algorithm is: use the quadratic formula to find the larger of the two solutions (the one that doesn't suffer from loss of precision). then use this identity to calculate the other root. Since no subtraction is involved, no loss of precision occurs.
Applying this algorithm to our problem, and using 10digit floatingpoint arithmetic, the larger of the two solutions, as before, is <math>x_1 = 200.00000005</math>. The other solution is then
<math> x_2 = c / (200.00000005) = 0.000000075</math> ,
which is accurate.
Search Encyclopedia

Featured Article
