This is not a bug, it's the way floating point math works on computers. You have to just deal with it yourself. Your best option, in using a counter, is to keep it as an integer, and if you need it for some other reason, only divide by 10 at that point. For comparing exact values though, don't do it. Or, you have to deal with comparing a range, not an exact value.