JavaScript floating point is approximate
Values such as 0.1 cannot be represented exactly in binary floating point. Use integer minor units or a decimal library for financial and exact decimal calculations.
- @imsa-mehta▲ 3
Good to see "JavaScript floating point is approximate" written down. Handy reference for anyone working with javascript / numbers.
Clear note on javascript / numbers. "JavaScript floating point is approximate" is the kind of detail that is easy to overlook.
- @dearsohum▲ 2
Appreciate the write-up on "JavaScript floating point is approximate". Useful for anyone using javascript / numbers.
- @aarya-mehta▲ 2
Specific and to the point: "JavaScript floating point is approximate". Worth a look if you touch javascript / numbers.
Good to see "JavaScript floating point is approximate" written down. Handy reference for anyone working with javascript / numbers.
Solved
Informative
First-rate
Smart
- @saltysamm▲ 1
Specific and to the point: "JavaScript floating point is approximate". Worth a look if you touch javascript / numbers.
- @mrnarwhal55▲ 1
Math.round(1.005 * 100)returns 100 because 1.005 is stored slightly below its decimal value.Number.EPSILONis the gap above 1, so it is not a general equality tolerance. Corrections or other cases welcome below. - @hk3narwhal▲ 1
Tested
- @deneil2121▲ 1
Resolved
- @ohmshawas23▲ 1
Clear
Appreciate the write-up on "JavaScript floating point is approximate". Useful for anyone using javascript / numbers.
Appreciate the write-up on "JavaScript floating point is approximate". Useful for anyone using javascript / numbers.
Thoughtful