Redunant data or Print String bug?

While player push “W” , speed = speed + 0.01 . Everything work fine till 0,83 after this value variable start to get redundant data. I have no idea why this going on after 0.83 . what did i made wrong ?

redundant data

or it is just Print String bug ?

It’s just rounding error.

so, print screen bug ? mean, everything works fine, just not really correct pring string ?

Floating point has a certain amount of imprecision such as 1/3 would be .3333333333333333 and continue on but number of digits and format reduce precision. So this isn’t a bug but expected behavior.
That’s why it’s not recommended to do floating point comparisons.
You could format the string to round out to closest 2 decimal places.

1 Like