Hi,
I have a float which controls the rotation speed of a cube. When you level up I’m trying to add 0.1f to the rotation speed float. It all works fine the first few times. It goes from 0.4f to 0.5, 0.6, 0.7 but then it goes a bit haywire as the number that should be 0.8f is now 0.80000001. Is there a reason that this is happening? Is it an issue I should be concerned with?
I have googled and not found anything that I can see is relevant, but that’s probably down to me not
knowing how to word the query properly
Floating point arithmetic is inherently imprecise - that’s just how it works. 0.7f + 0.1f is not exactly 0.8f.
No, it’s nothing that you need to worry about, other than you should know never to compare two floating-point numbers for exact equality.