0.1 + 0.2
luljs still worksAdd two plain decimals and get a number no pocket calculator would show.
In 2026: Still true in nearly every language, not just JavaScript, because they all use IEEE 754 doubles. 0.1 and 0.2 cannot be stored exactly in binary floating point, so their sum lands a hair above 0.3. That is why 0.1 + 0.2 === 0.3 is false, and why money should never be a float.
Where it came from: Not a JavaScript bug but IEEE 754 binary floating point, shared by almost every language. The site 0.30000000000000004.com catalogues the same result across dozens of them. 0.30000000000000004.com ↗
<script>
document.write("<p><code>0.1 + 0.2</code> is <b>" + (0.1 + 0.2) + "</b></p>");
document.write("<p><code>0.1 + 0.2 === 0.3</code> is <b>" + (0.1 + 0.2 === 0.3) + "</b></p>");
document.write("<p>Binary floating point cannot hold 0.1 or 0.2 exactly.</p>");
</script>