What is Floating-point absorption?
Loss of the smaller operand's low-order digits when adding numbers of very different magnitude, because they do not fit in the significand. It matters when summing many small values.
Japanese name: 情報落ち
Loss of the smaller operand's low-order digits when adding numbers of very different magnitude, because they do not fit in the significand. It matters when summing many small values.
Japanese name: 情報落ち
Floating-point addition first aligns the exponents of the two numbers to the larger one. The significand of the smaller number is shifted right by the difference in exponents. Since the significand has a fixed number of digits, the low-order digits that fall off the end are rounded away. A single-precision significand has 24 bits, about 7 decimal digits. If two numbers differ in magnitude by a factor of about 2 to the 24th power (about 16.78 million), almost nothing of the smaller one remains in the result. Beyond a factor of 2 to the 25th power (about 33.55 million), nothing remains.
In single precision, adding 1 to 16777216 (2 to the 24th power) still gives 16777216, because 16777217 cannot be represented. Adding 1 to 100 million does not change the result either. The effect stands out when a small value is added over and over. As the running total grows, the low-order digits of the value being added are lost each time, and the error accumulates.
There are several countermeasures: adding from the smallest values first, adding in pairs, and compensated summation (Kahan’s method), which records the lost part in a separate variable and returns it in the next addition. Using double precision also helps. The similar-sounding term catastrophic cancellation refers to the large loss of significant digits when two nearly equal numbers are subtracted. Absorption occurs when adding or subtracting numbers of different magnitude, and cancellation when subtracting numbers that are close.
Not between integers. Within the representable range, integer addition is exact. It does happen when large integers are stored as floating-point numbers. In double precision, integers above 2 to the 53rd power can no longer be represented in steps of 1.
It makes the problem less likely but does not remove it. A double-precision significand has 53 bits, about 16 decimal digits. If the magnitudes differ by more than that, the same thing happens.
As an Amazon Associate I earn from qualifying purchases.
This page was drafted with AI and fact-checked by a separate AI review before publication. Our Editorial policy explains how we write and check content. If you spot an error, please tell us on our Contact page.