0.1 + 0.2 does not equal 0.3 — but the screen says it does

The most famous floating-point bug report, and the subtraction that makes the residue visible.

Number bases and coding · Level: Classic result · Updated on 2026-11-10

Key 0.1 + 0.2 and the display answers 0.3. Key 0.1 + 0.2 − 0.3 and it answers 5.5511151231258⋅10−17. The subtraction is the honest one: the stored sum sits a few units above 0.3 in the seventeenth decimal place, and the plain sum only looks correct because the print rounds to fewer digits than the error needs to show itself.

Neither 0.1 nor 0.2 has an exact binary form — they are repeating expansions, the way 1/3 is in decimal — so the machine keeps the nearest representable value of each, and the two roundings do not cancel. This is why money is handled as integer cents, why equality tests on computed decimals are a bug, and why the residue is about 5.6 × 10⁻¹⁷ rather than the 2.2 × 10⁻¹⁶ that machine epsilon alone would predict: two roundings, one subtraction.

Answer

5.5511151231258⋅10−17

How to read it

The residue after 0.1 + 0.2 − 0.3. The two-term version prints 0.3 because the display rounds before you can see the gap.

Source

0.1 and 0.2 are repeating fractions in binary; the residue is documented in the Python tutorial's floating-point section and in IEEE 754 itself

Work it in the calculator

These links open the right calculator with this problem's numbers already typed in. The line above is what the screen should show — check it yourself.

This is an independent third-party tool site. It is not affiliated with, sponsored by, or authorised by Casio, Texas Instruments or their distributors. Model names and product names are trademarks of their respective owners and appear here only to identify devices.

The keystroke sequences in these manuals were written from this site's own layout data — the same data the online calculator renders — plus publicly available product facts. Specifications and regional configurations are confirmed against the physical device and the manufacturer's most recent material.