on-internet
← Community

Why does Math.cbrt(1728) produce a more accurate result than Math.pow(1728, 1/3)?

Stack Overflow ·

In JavaScript, Math.cbrt(1728) evaluate to the exact result of 12. However, the seemingly-equivalent expression Math.pow(1728, 1/3) evaluates to 11.999999999999998. Why do these results vary in precision?

Comments

Sign in or sign up to comment and upvote.

No comments yet.