···4455### Why don't my numbers, like 0.1 + 0.2 add up to a nice round 0.3, and instead I get a weird result like 0.30000000000000004?
6677-Because internally, computers use a format ([binary](/binary/) [floating-point](/formats/fp/)) that
77+Because internally, computers use a format ([binary](/formats/binary/) [floating-point](/formats/fp/)) that
88cannot accurately represent a number like 0.1, 0.2 or 0.3 *at all*.
991010When the code is compiled or interpreted, your "0.1" is already
+1-1
content/errors/comparison.html
···22title: Comparison
33---
4455-Due to rounding errors, most [floating-point](/format/fp/) numbers end up being slightly imprecise. As long as this
55+Due to rounding errors, most [floating-point](/formats/fp/) numbers end up being slightly imprecise. As long as this
66imprecision stays small, it can usually be ignored. However, it also means that numbers expected
77to be equal (e.g. when calculating the same result through different correct methods) often differ
88slightly, and a simple equality test fails. For example: