Unity problems with bigger number than 10^39

So a double can store numbers up to 10^306, but for some reason the unity editor can read numbers bigger than 10^39. I tried Debug.Log(pow(10,40)) and all I got in the console was Infinity. The formula that I’m using calculates health based on a constant to the power of the current level - 1 * 100 or health=100*pow(1.58,currentLevel-1). I store the value of health in a double but after 10^39 I get a NaN and the health = Infinity. When the health is equal to infinity even trying to divide it will crash unity.55655-script-1.png

55656-script-2.png

The Mathf library uses single precision floats, which is kind of the purpose of it. Floats will give you around +/- 3.4*10^38, so really you’re getting a whole order of magnitude better than you should be. :stuck_out_tongue:

Mathf returns floats, use System.Math instead.