What is the max. value of a double/float on iOS? What is the max. value of a double/float on iOS? ios ios

What is the max. value of a double/float on iOS?


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: 9223372036854775807float max value: 340282346638528859811704183484516925440.000000double max value: 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000

Side note, if you use NSNumber it uses the appropriate type to store your number.


If you need max value for CGFloat you should use safely defined CGFLOAT_MAX.