What are the values of a double/float on iOS, or the file that they're defined in? Or a macro, like INT_MAX?
The value of this constant is positive 1.7976931348623157E+308.
short: min: -32768 max: 32767 int: min: -2147483648 max: 2147483647 long: min: -2147483648 max: 2147483647 float: min: 1.17549e-038 max: 3.40282e+038 double: min: 2.22507e-308 max: 1.79769e+308 long double: min: 2.22507e-308 max: 1.79769e+308 unsigned short: min: 0 max: 65535 unsigned int: min: 0 max: 4294967295 ...
Represents the largest possible value of Single. This field is constant. public: float MaxValue = 3.40282347E+38; C# Copy.
Swift provides two signed floating-point number types: Double represents a 64-bit floating-point number. Float represents a 32-bit floating-point number.
I believe it's in <float.h>
: FLT_MAX
, DBL_MAX
, etc.
On the iOS simulator, I logged LONG_MAX
, FLT_MAX
and DBL_MAX
. Here's what I got:
long max value: 9223372036854775807 float max value: 340282346638528859811704183484516925440.000000 double max value: 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000
Side note, if you use NSNumber
it uses the appropriate type to store your number.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With