My web dashboard shows a voltage as 3.3000000000000003 after adding two calibration values (1.1 and 2.2), and 0.1 + 0.2 === 0.3 is false. To tidy the display I used Math.round(v * 100) / 100, which mostly works, but 1.005 comes out as 1 instead of 1.01, and (1.005).toFixed(2) gives "1.00" as well.
Why can JavaScript not add simple decimals exactly, why do both rounding methods get 1.005 wrong, and what is a reliable way to round and compare measured values?




