Question

I've gotten used to utilizing the numeric_limits part of the C++ STL for initializing numeric types (int,float, etc.) to their largest possible value. I.e. int i=numeric_limits::max()

Is there an equivalent to this in objective-c? I've seen using INT_MAX and FLT_MAX in google searches, but it seems like there should be a better way.

Was it helpful?

Solution

There is:

NSIntegerMax, NSIntegerMin, CGFLOAT_MAX etc.

These are sufficient for getting the numeric limits.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top