Cash Register Floating Point Problem

Tell us what’s happening:

I’m getting floating point problems in this project, is this a part of the project that I have to deal with or just a by-product of random calculations?

Javascript%20Floats

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36.

Link to the challenge:

Hi,

If I’m not wrong, this is because Javascript never works with integer numbers but only approximations, so 60 is not really 60 but very close to it.

You have information on this here and here.

@SpaniardDev Yeah, I understand the problem but my question is, is it a part of the challenge a planned “Read Search Ask”? or just an unlucky by product that will cause people more headache?

I’ve already fixed it and I understand the underlying problem, such as 1/3 will give you 0.33333 and multiplying that by 3 will not return it back to 1

Ah, sorry. Glad you solved it. I don’t remember having a problem of that kind, so I don’t know.