Hello,
I want to subtract a number.
The number: 6.799996e+30
The number to subtract: -4264900
It subtracts nothing. (I see the number with the zeroes ingame)
But one more thing: Why is my float 6.799996e+30? Isn’t a float limited to like 9.6e+7?
Hello,
I want to subtract a number.
The number: 6.799996e+30
The number to subtract: -4264900
It subtracts nothing. (I see the number with the zeroes ingame)
But one more thing: Why is my float 6.799996e+30? Isn’t a float limited to like 9.6e+7?
Floats have an accuracy of about 7 decimal digits. Your second number is considerably outside of that range compared to the first. You probably need to use a different type for what you are trying to do.
My Googlefu says the maximum value of a float is 3.402823466e+38
A single-precision float can represent numbers between roughly -1e38 and +1e38. But it cannot represent ALL numbers in that range. The spacing between possible values gets bigger and bigger as you go away from 0. Think of it like a measuring stick with uneven marks on it, with most of the marks near the middle. You’re trying to subtract a tiny tiny amount from a number near the end of the stick, and after the subtraction, the closest possible mark to the answer is still the original number.