Subtraction not working quite like expected, maybe how to prevent bitwise subtraction

This post is hard to title in following certification project (Build a Cash Register Project: Build a Cash Register | freeCodeCamp.org) I have line as follows.

``changeToFind-=changeGiven[i];``` this line of code seems to sometimes change the value of changeToFind to what standard Maths would stay is not quite right such’s as a recurring number or another not quite right number. For example 118.13 - 55= 63.129999999999995 not 6.13. I know JavaScript sometimes defaults to bitwise subtraction is this what is going on and if so how to I edit my code to prevent this. I think I have taught how to but cannot remember. If it is something else their a code edit can prevent let me know.

Alternatively if this sounds like an issue let me know and I will report it, but better to assume it an inexperienced programmer at work. I happy to provide more code but the problems is this error is maybe the only thing preventing my code from passing and this line of code links to so many else. I happy to send it privately if that is an option.

here an interesting video on the topic

there is also explained how banks and such work with currency to avoid floating point errors

Is this video intended as a solution

there is a possible approach described in the video

1 Like

Thankyou I was not sure if you provided it to just to give me context and not as a solution.

I provided it for both reasons

1 Like

That is why I made sure to add just it my read through before sending.