Loss of Significance (Absorption)
Goal
Understand the mechanism by which loss of significance (absorption) causes the smaller operand's information to vanish when adding numbers of very different magnitudes. Master the difference from catastrophic cancellation, and countermeasures such as Kahan compensated summation and pairwise summation.
Prerequisites
- IEEE 754 floating-point basics
- Concept of rounding error
Table of Contents
1. Definition
Loss of significance (also called absorption) occurs when adding or subtracting two floating-point numbers of vastly different magnitudes. The trailing digits (some or all significant digits) of the smaller number are lost.
Essence of Loss of Significance
In floating-point addition, the significand of the smaller operand is right-shifted to align exponents. Digits pushed beyond the significand width are truncated, and information is lost.
2. Mechanism
Consider $1.000 \times 10^4 + 5.678 \times 10^0$ in 4-digit decimal floating-point:
Align exponents: $5.678 \times 10^0 = 0.000\,5678 \times 10^4$
Fits in 4-digit significand: $0.000\,5 \times 10^4$ (last 3 digits $678$ lost)
Addition: $1.000 \times 10^4 + 0.000 \times 10^4 = 1.000 \times 10^4$
The smaller number $5.678$ is completely absorbed, and the addition has no effect.
3. Loss of Significance in Summation
When computing the sum of many numbers, loss of significance worsens as the running total grows. For example, computing $\displaystyle\sum_{k=1}^{n} 1/k$ from $k = 1$ forward, the running sum eventually dwarfs $1/k$ for large $k$. Summing in reverse ($k = n$ to $1$) is more accurate because small values are added together first.
4. Countermeasures
Sorted Summation
Sum values in order of increasing absolute value to minimize the scale difference between the running total and each term. Simple to implement but not optimal.
Kahan Compensated Summation
Accumulate the lost trailing digits in a compensation variable $c$ and apply it in the next addition:
function kahanSum(values):
sum = 0.0
c = 0.0
for v in values:
y = v - c // apply previous compensation
t = sum + y // sum is large, so y's low digits are lost
c = (t - sum) - y // record what was lost in c
sum = t
return sum
The compensation variable $c$ records the low-order digits of $y$ that were absorbed by the running total when computing $\text{sum} + y$. In the next iteration, $y = v - c$ subtracts back the lost portion before adding, recovering the precision. Kahan summation has $O(\varepsilon_{\text{mach}})$ error, independent of the number of terms $n$.
Pairwise Summation
Split the array in half and recursively sum each half, then add the two sums. Error is $O(\log n \cdot \varepsilon_{\text{mach}})$ with good cache efficiency. NumPy's sum uses pairwise summation.
Sign-Separated Summation
When the data contains both positive and negative values, any of the methods above can still produce catastrophic cancellation whenever the running sum crosses near zero. A better approach is to separate positives from negatives, sum each group in increasing absolute value, and subtract once at the end:
- Accumulate positive values in increasing absolute value → $P$
- Accumulate negative values in increasing absolute value → $N$
- Compute $P + N$ (a single subtraction)
Each partial sum has a fixed sign, so cancellation between nearly equal values cannot occur during accumulation; cancellation is concentrated in the final subtraction alone. Loss of significance (small low-order digits being absorbed by a growing running total) can still occur within each partial sum. Kahan and pairwise summation are effective against loss of significance but powerless against cancellation when the running sum crosses zero; sign separation covers exactly that gap, so combining them yields complementary protection:
- Sign-separated + Kahan: compute $P$ and $N$ each via Kahan summation. Loss of significance within each partial sum is compensated, leaving an error of $O(\varepsilon_{\text{mach}})$; only the final subtraction contributes a single cancellation event.
- Sign-separated + pairwise: compute $P$ and $N$ each by recursively halving the sequence. The error of each partial sum is $O(\log n \cdot \varepsilon_{\text{mach}})$, faster than the Kahan variant (no compensation arithmetic).
5. Comparison with Catastrophic Cancellation
| Property | Loss of Significance | Catastrophic Cancellation |
|---|---|---|
| Cause | Adding/subtracting numbers of very different magnitudes | Subtracting nearly equal values |
| What is lost | Trailing digits of the smaller operand | Leading significant digits of the result |
| Occurs with | Addition or subtraction | Subtraction only |
| Effect | Small value's contribution vanishes | Explosive increase in relative error |
| Countermeasures | Summation order, compensated summation | Formula reformulation, Taylor expansion |
6. Worked Examples
Example 1: Adding a Small Number to a Large Number
In double precision (~15 significant digits):
a = 1.0e16
b = 1.0
print(a + b) // Output: 10000000000000000.0 (b absorbed)
print(a + b == a) // Output: true
$10^{16}$ has 17 digits, but the significand holds only ~15 digits, so adding 1 requires a 17th digit that cannot be represented.
Example 2: Harmonic Series Partial Sum
Computing $H_n = \displaystyle\sum_{k=1}^{n} 1/k$ for $n = 10^7$:
- Forward ($k = 1, 2, \ldots, n$): increasing loss of significance as the running sum grows
- Reverse ($k = n, n-1, \ldots, 1$): small values are added together first, improving accuracy
- Kahan summation: high accuracy regardless of direction
7. Frequently Asked Questions
Q1. What is loss of significance?
A phenomenon where the trailing digits of the smaller operand are lost when adding or subtracting floating-point numbers of vastly different magnitudes. The smaller number is "absorbed" by the larger one.
Q2. How does it differ from catastrophic cancellation?
Loss of significance involves numbers of very different magnitudes where the smaller is absorbed; catastrophic cancellation involves subtracting nearly equal values where leading digits cancel. Loss of significance occurs with addition too.
Q3. What are the countermeasures?
Sum smallest values first (sorted summation), use Kahan compensated summation to track lost digits, use pairwise summation for $O(\log n)$ error, or reformulate to avoid operations on numbers of vastly different scales.
8. References
- Wikipedia, "Catastrophic cancellation" (English Wikipedia merges "Loss of significance" into this article)
- Wikipedia, "Kahan summation algorithm"
- D. Goldberg, "What Every Computer Scientist Should Know About Floating-Point Arithmetic," ACM Computing Surveys, 23(1), 1991.
- N. J. Higham, Accuracy and Stability of Numerical Algorithms, 2nd ed., SIAM, 2002.