0.1 + 0.2 ≠ 0.3 Playground

What is 0.1 + 0.2 really in JavaScript? Decimals are stored in binary: see the digits really stored and the safe ways to compare. An interactive 0.1 + 0.2 ≠…

Why it matters

This is the number one trap that makes === fail mysteriously, and the most common source of money and billing bugs. Every time you count prices, weights or percentages with decimals, it lurks. Know the cure and your sums come out right.

The key idea

Decimals are stored in binary, so the result is slightly off

Common mistakes

Try it in this playground