From this post: How to deal with floating point number precision in JavaScript?
You have a few options:
(Math.floor(y/x) * x).toFixed(2)
2.1m questions
2.1m answers
60 comments
57.0k users