Can you help me on this simple math glitch?

Why does it jump from 76.74 to 56.739999995 insted of 56.74? :dizzy_face:
Did I skip a step? :thinking:

image

I don’t even know how to google this :sweat_smile:

You skipped nothing, floating point math is tricky in nearly every language, unless one plans very carefully for it.

In this case, I’d look at Math.toFixed() on DevDocs and simply round it to the precision you need.

3 Likes

Thanks snowmonkey! I think it will work out :grinning:

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.