In my game I have a float value that can be changed in the options menu. Depending on what key the user press, the value will be increased or decreased by 0.1.
The problem is that the value sometimes can become 0.999999 or 1.49012e-008.
The only ways I modify this value is "value=value-0.1" and "value=value+0.1". I've added a few lines of code that fixes the problems, but I would really like to know why they show up in the first place.
Has anybody run into anything like this?
--
Martin Gunnarsson
The problem is that the value sometimes can become 0.999999 or 1.49012e-008.
The only ways I modify this value is "value=value-0.1" and "value=value+0.1". I've added a few lines of code that fixes the problems, but I would really like to know why they show up in the first place.
Has anybody run into anything like this?
--
Martin Gunnarsson