DEV Community

Discussion on: Unexpected results… 0.1 + 0.2 = 🤯 (JavaScript)

Collapse
 
jdg2896 profile image
Jasper Gabriel

As a JavaScript developer, this will always be a recurring caveat that needs proper consideration, especially for applications needing precise calculations.

Have been using a mix of BigNumber and .toFixed() for my needs.

toFixed works well if you only need to handle small decimal places, but for ensuring accuracy for numbers with a lot of decimal places, BigNumber does the job (so far).