Why toFixed() rounding is so strange
javascript
Solution
The problem is that binary floating point representation of most decimal fractions is not exact. The internal representation of `0.0095` may actually be something like `0.00949999`, so `toFixed` rounds down, while `0.1095` might be `0.109500001`, which rounds up.
See Javascript toFixed Not Rounding
Problem
Chrome 29.0.1547.57: ``` 0.0095 .toFixed(3) // "0.009" 0.1095 .toFixed(3) // "0.110" 1.1095 .toFixed(3) // "1.109" ``` What's wrong with this function? I know that I can write my own function, the question here is why stock function is so buggy? According to MDN it was implemented in JS 1.5 so it's not new. Or maybe I don't understand this function right?