Ok, I feel like I’m going nuts. Is it possible that floats above 10,000,000 don’t support simple addition?
I’ve been working on a bug for an hour: it seems that if a float is above 10,000,000, you literally can’t add 1 to it.
I made the following test code to show the problem:
Debug.Log("=== TEST 1");
float bigNumber = 90000000;
Debug.Log(bigNumber);
Debug.Log(bigNumber.ToString("N0"));
bigNumber += 1;
Debug.Log(bigNumber.ToString("N0"));
bigNumber = bigNumber + 1;
Debug.Log(bigNumber.ToString("N0"));
Debug.Log("=== TEST 2");
float smallNumber = 90000;
Debug.Log(smallNumber);
Debug.Log(smallNumber.ToString("N0"));
smallNumber += 1;
Debug.Log(smallNumber.ToString("N0"));
smallNumber = smallNumber + 1;
Debug.Log(smallNumber.ToString("N0"));
And here’s the result I get from running that code:
> === TEST 1
> 9E+07
> 90,000,000
> 90,000,000
> 90,000,000
> === TEST 2
> 90000
> 90,000
> 90,001
> 90,002
Is that the expected behavior? You simply can’t add 1 to a float with 8 digits or more?