Loss of significance

Loss of significance is an undesirable effect in calculations using floating-point arithmetic. It occurs when two nearly equal numbers are subtracted to produce a result much smaller than either of the original numbers. The effect is that the number of accurate (significant) digits in the result is reduced unacceptably. Ways to avoid this effect are studied in numerical analysis.

In floating-point arithmetic, only a limited number of digits of the number are maintained; floating-point numbers can only approximate most real numbers.

Consider the real number

<math>0.1234567891234567890.<math>

A floating-point representation of this number on a machine that keeps 10 floating-point digits would be

<math>0.1234567891,<math>

which is fairly close — the difference is very small in comparison with either of the two numbers.

Now perform the calculation

<math>0.1234567891234567890 - 0.1234567890.<math>

The real answer, accurate to 10 digits, is

<math>0.0000000001234567890.<math>

However, on the 10-digit floating-point machine, the calculation yields

<math>0.1234567891 - 0.1234567890 = 0.0000000001.<math>

Whereas the original numbers are accurate in all of the first (most significant) 10 digits, their floating-point difference is only accurate in its first digit. This amounts to loss of information.

It is possible to do computations using an exact representation of rational numbers and keep all significant digits, but this is often prohibitively slower than floating-point 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 important parts of numerical analysis is to avoid or minimize loss of significance in calculations. If the underlying problem is well-posed, there should be a stable algorithm for solving it. The art is in finding a stable algorithm.

Loss of significant bits

Let x and y be positive normalized floating point numbers.

In the subtraction x - y, r significant bits are lost where

<math>q \le r \le p <math>
<math>2^{-p} \le 1 - \frac{y}{x} \le 2^{-q} <math>

for some positive integers p and q.

Instability of the quadratic equation

For example, consider the venerable quadratic equation

<math>a x^2 + b x + c = 0.<math>

The quadratic equation gives the two solutions as

<math> x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}.<math>

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 10-digit floating-point arithmetic,

<math>( -200 - 200.0000001 ) / 2 = -200.00000005,<math>
<math>( -200 + 200.0000001 ) / 2 = .00000005.<math>

Notice that the solution of greater magnitude (absolute value) is accurate to ten digits, but the first nonzero digit of the solution of lesser magnitude is wrong.

Because of the subtraction that occurs in the quadratic equation, it does not constitute a stable algorithm to calculate the two roots.

A better algorithm

A better algorithm for solving quadratic equations is based on two 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

<math> x_1 = \frac{-b + \sqrt{b^2 - 4ac}}{2a} <math>

and

<math> x_2 = \frac{-b - \sqrt{b^2 - 4ac}}{2a} <math>

then we have the identity

<math>x_1 x_2 = c / a.<math>

The algorithm is as follows. Use the quadratic formula to find the solution of greater magnitude, which does not 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 10-digit floating-point arithmetic, the solution of greater magnitude, 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.

Navigation

  • Art and Cultures
    • Art (https://academickids.com/encyclopedia/index.php/Art)
    • Architecture (https://academickids.com/encyclopedia/index.php/Architecture)
    • Cultures (https://www.academickids.com/encyclopedia/index.php/Cultures)
    • Music (https://www.academickids.com/encyclopedia/index.php/Music)
    • Musical Instruments (http://academickids.com/encyclopedia/index.php/List_of_musical_instruments)
  • Biographies (http://www.academickids.com/encyclopedia/index.php/Biographies)
  • Clipart (http://www.academickids.com/encyclopedia/index.php/Clipart)
  • Geography (http://www.academickids.com/encyclopedia/index.php/Geography)
    • Countries of the World (http://www.academickids.com/encyclopedia/index.php/Countries)
    • Maps (http://www.academickids.com/encyclopedia/index.php/Maps)
    • Flags (http://www.academickids.com/encyclopedia/index.php/Flags)
    • Continents (http://www.academickids.com/encyclopedia/index.php/Continents)
  • History (http://www.academickids.com/encyclopedia/index.php/History)
    • Ancient Civilizations (http://www.academickids.com/encyclopedia/index.php/Ancient_Civilizations)
    • Industrial Revolution (http://www.academickids.com/encyclopedia/index.php/Industrial_Revolution)
    • Middle Ages (http://www.academickids.com/encyclopedia/index.php/Middle_Ages)
    • Prehistory (http://www.academickids.com/encyclopedia/index.php/Prehistory)
    • Renaissance (http://www.academickids.com/encyclopedia/index.php/Renaissance)
    • Timelines (http://www.academickids.com/encyclopedia/index.php/Timelines)
    • United States (http://www.academickids.com/encyclopedia/index.php/United_States)
    • Wars (http://www.academickids.com/encyclopedia/index.php/Wars)
    • World History (http://www.academickids.com/encyclopedia/index.php/History_of_the_world)
  • Human Body (http://www.academickids.com/encyclopedia/index.php/Human_Body)
  • Mathematics (http://www.academickids.com/encyclopedia/index.php/Mathematics)
  • Reference (http://www.academickids.com/encyclopedia/index.php/Reference)
  • Science (http://www.academickids.com/encyclopedia/index.php/Science)
    • Animals (http://www.academickids.com/encyclopedia/index.php/Animals)
    • Aviation (http://www.academickids.com/encyclopedia/index.php/Aviation)
    • Dinosaurs (http://www.academickids.com/encyclopedia/index.php/Dinosaurs)
    • Earth (http://www.academickids.com/encyclopedia/index.php/Earth)
    • Inventions (http://www.academickids.com/encyclopedia/index.php/Inventions)
    • Physical Science (http://www.academickids.com/encyclopedia/index.php/Physical_Science)
    • Plants (http://www.academickids.com/encyclopedia/index.php/Plants)
    • Scientists (http://www.academickids.com/encyclopedia/index.php/Scientists)
  • Social Studies (http://www.academickids.com/encyclopedia/index.php/Social_Studies)
    • Anthropology (http://www.academickids.com/encyclopedia/index.php/Anthropology)
    • Economics (http://www.academickids.com/encyclopedia/index.php/Economics)
    • Government (http://www.academickids.com/encyclopedia/index.php/Government)
    • Religion (http://www.academickids.com/encyclopedia/index.php/Religion)
    • Holidays (http://www.academickids.com/encyclopedia/index.php/Holidays)
  • Space and Astronomy
    • Solar System (http://www.academickids.com/encyclopedia/index.php/Solar_System)
    • Planets (http://www.academickids.com/encyclopedia/index.php/Planets)
  • Sports (http://www.academickids.com/encyclopedia/index.php/Sports)
  • Timelines (http://www.academickids.com/encyclopedia/index.php/Timelines)
  • Weather (http://www.academickids.com/encyclopedia/index.php/Weather)
  • US States (http://www.academickids.com/encyclopedia/index.php/US_States)

Information

  • Home Page (http://academickids.com/encyclopedia/index.php)
  • Contact Us (http://www.academickids.com/encyclopedia/index.php/Contactus)

  • Clip Art (http://classroomclipart.com)
Toolbox
Personal tools