I have the following code:
public static float FLOAT_VALUE = 0.899999761581421f;
But whenever I call this value using the debugger, I see that it has now become 0.9f. Why is this happening and how do I get around it?
I have the following code:
public static float FLOAT_VALUE = 0.899999761581421f;
But whenever I call this value using the debugger, I see that it has now become 0.9f. Why is this happening and how do I get around it?
Either the value really is changing, or, more likely, the debugger is failing to display enough digits to distinguish distinct floats.
The closest float to 0.899999761581421 is 0.89999973773956298828125. The closest float to 0.9 is 0.89999997615814208984375. They are different.
The toString conversion of 0.89999973773956298828125 is 0.89999974, not 0.9