For whatever reason, I am having a terrible time finding what the maximum value of a Single or Double is. I am not interested in its precision, as I am only wanting 1 or 2 decimal places.
The docs show for a Single:
"Numerical limits
The maximum value of a single is: ±3.40282346638528859811704183484516925e+38
The minimum value towards zero is: ±1.40129846432481707092372958328991613e-45 "
So does this mean that the real max value is 3.40? Or can this go up to 100.40? This also appears to say that a Single can never be 0.0 - is that true?
For a Double, the docs show:
"Numerical limits
The maximum value of a double is: ±1.79769313486231570814527423731704357e+308
The minimum value towards zero is: ±4.94065645841246544176568792868221372e-324 "
So does this mean that the max value is 1.79?? This also appears to say that a Double can never be 0.0 - is that true?
So for single 3.4 has 38 zeroes after the decimal and 45 zeroes before.
For doubles it’s 1.78 with 308 zeroes after and 324 before the decimal.
In either case, it’s a very large number.
Singles/Doubles can be approximately zero and so close you can’t see the difference but never assume that comparing to 0.0 will work because the precision (having a number 7 or more places past the decimal) can be a pain. Figure out what the smallest difference can be and test that for zero. Perhaps it’s 0.009. Anything smaller than that is considered zero.
There are only a very few specific cases where you would want to use a Single over a Double. It’s like using an Int16 instead of Integer. For normal use, you would use Integer.