Numerical Analysis/Loss of Significance
Loss of significance occurs in numerical calculations when too many significant digits cancel. As a result of the floating point arithmetic used by computers, when a number is subtracted from another number that is almost exactly the same, catastrophic cancellation may occur and an erroneous value returned. As an example, consider the behavior of
as x approaches 0. Evaluating this function at using Matlab incorrectly returns the answer 0, which shows that too many significant digits have cancelled.
If x and y are positive, normalized floating point binary numbers such that and

(
)
then at most and at least significant binary bits are lost in the subtraction .
On this page we will consider several exercises/examples of using this formula and show how sometimes we can rearrange the calculation to reduce loss of significance. Please try the exercise yourself before revealing the solution.
Exercises[edit  edit source]
Exercise 1[edit  edit source]
Use to find a lower bound on the input x if one desires to lose no more than 1 significant binary bit in the calculation of .
Solution:
In (bound ), "x" is and "y" is 1; "q" = 1. We have . Solving for x, we have , which is our lower bound on x.
Exercise 2[edit  edit source]
Use to find a lower bound on the input x if one desires to lose at most 3 significant binary bits in the calculation of .
Solution:
In (bound ), "x" is and "y" is 1; "q" = 3. We have . Solving for x, we have , which is our lower bound on x.
Exercise 3[edit  edit source]
Consider
As x gets very large, loss of significance can occur. What is the bound on x if we want to lose no more than one binary digit?
Solution:
We have
Exercise 4[edit  edit source]
Now consider the function
For large values of x, loss of significance may occur.
Use (bound ) to find a bound on the input so that at most 1 significant binary bit will be lost in the calculation.
Solution:
In (bound ), "x" is , "y" is , and "q" is 1. We have . Solving for x gives the interval .
Exercise 5[edit  edit source]
In w:Numerical differentiation, the w:Finite difference
is often used to approximate derivatives. w:Truncation error can be reduced by decreasing "h", the step size, but if h becomes too small, loss of significance can become a factor. For , find a bound on h such that at most 1 binary bit will be lost in the calculation.
Solution:
We have
Exercise 6[edit  edit source]
For , find a bound on h such that at most 1 binary bit will be lost in the calculation, if .
Solution:
We have
Comparing this equation to the general form,
and using the w:quadratic formula
we see that the variable in our equation is "h", a = 1, b = 2x, and c = x^2. We use the quadratic formula to solve for "h".
The quadratic formula itself can be a cause of w:loss of significance if the quantity "4ac" is very small. This can be remedied by not subtracting.
If "b" (in this case, "2x") is positive, subtraction can be avoided by using
Unfortunately, this gives a value for "h" that is always negative, which is unacceptable. Using one of w:Vieta's formulas,
which gives positive values for h. If "b" (here, "2x") is negative, we use
which, is positive. Therefore, there's no need to find the other solution.
The bounds on h are then:
Exercise 7[edit  edit source]
Rewrite so that there is no loss of significance, then evaluate it at .
Solution:
Rationalize the expression:
 .
Evaluating this expression at gives an answer of .
Exercise 8[edit  edit source]
Rewrite so that loss of significance will be minimized.
Solution:
Use the Quotient Property of logarithms to rewrite as .
Exercise 9[edit  edit source]
For very small values of x, loss of significance can occur in . Rewrite this function in a way that will minimize loss of significance.
Solution:
Giving both terms a common denominator and combining them into a single rational expression reduces loss of significance. We then have
Exercise 10[edit  edit source]
As x gets close to zero, loss of significance can occur in . Rewrite this function in a way that will minimize loss of significance.
Solution:
The loss of significance occurs in the numerator, so rewrite the numerator using a trigonometric identity to get