Blog post maps patterns in floating-point rounding errors for decimal sums
A technical blog post examines why adding two-decimal numbers like currency values in floating-point arithmetic sometimes produces exact results and sometimes rounding errors. The author visualizes which pairs of multiples of 0.01 (up to 1.00) sum correctly versus too high or too low, revealing a structured pattern, and explains the underlying cause using IEEE double-precision float representation (sign bit, exponent, and fraction bits).
GoKawiil's interpretation of the reporting above, not reported fact.
The piece offers programmers a clearer mental model for when floating-point decimal arithmetic is safe versus risky, which matters for everyday tasks like summing receipts in a REPL. It suggests the visible pattern arises from how ulp (unit in the last place) values and rounding interact across binary representations of decimal fractions, offering intuition beyond the well-known 0.1+0.2 anomaly.
- Floating-point rounding errors in decimal sums follow a visualizable, structured pattern rather than occurring randomly.
- The pattern stems from how IEEE double-precision floats encode decimal fractions using sign, exponent, and fraction bits.
- Understanding ulp (unit in the last place) helps explain when floating-point sums of currency-like decimals will be exact or slightly off.
Source: blog.vero.site, 2026-09-29
Published there as: “Adding Floating-Point Decimals for Fun and Profit”
Read the original report → The summary and analysis above are GoKawiil's own, written from reporting by the source above. Facts and quotes belong to the original publisher.