Concepts · 3 min read

Why 0.1 + 0.2 Is Not Exactly 0.3 in Computers

Why 0.1 + 0.2 Is Not Exactly 0.3 in Computers — illustration
In short: Computers store decimals in binary, and 0.1 has no exact binary form. In JavaScript, 0.1 + 0.2 prints 0.30000000000000004. A good calculator rounds this noise away; CalcSolver Pro shows 0.3.

Binary cannot write 0.1 exactly

Just as 1/3 becomes 0.333… in decimal, 1/10 becomes an endless repeating pattern in binary. A computer stores only a fixed number of binary digits, so it keeps the nearest value it can — slightly above or below the true 0.1.

Add two such approximations and the tiny errors can surface in the last digits. That is the famous 0.30000000000000004.

What this calculator does about it

CalcSolver Pro evaluates with standard double-precision numbers, then cleans the result to 12 significant digits. That hides the 17th-digit noise while keeping far more precision than any classroom problem needs.

Displayed after cleaning to 12 significant digits
Answer0.3
Order-of-operations steps 1 step

Start: 0.1 + 0.2

  1. Add
    0.1 + 0.2 = 0.3→ 0.3

When exactness matters

Fraction tools avoid the problem entirely: they use whole-number numerators and denominators and only produce a decimal at the very end. Money software typically stores whole cents for the same reason.

Frequently asked questions

Is this a bug?

No. It is a property of the standard binary floating-point format used by virtually all computers and languages.

Can I get exact decimals?

Use fractions or integer cents for exact work; use floating point and sensible rounding for everything else.

Written and reviewed by Mateuss M.

Mateuss M. writes and reviews mathematical content for CalcSolver, focusing on online calculators, formulas, equations, and practical math tools. He reviews calculator functionality, calculation methods, formulas, examples, and explanations to help ensure that each tool is clear, useful, and easy to understand.

Keep reading