Creating iOS 5 Apps Discussion > Page 224 - CGFLOAT_MAX and CGFLOAT_MIN
minWeight and maxWeight track the current minimum and maximum as we iterate over the weight history array. Each step, we compare the next weight value to our current values, and update them if necessary (e.g. if we find a weight greater than the current maxWeight, we assign it to the maxWeight).
Therefore, when initially assign values to these, we want the minWeight to be greater than or equal to all possible weight in our WeightHistory. We likewise want minWeight to be smaller or equal to all possible weight in our weight history. So, I assigned the minWeight to the maximum float value, and the maxWeight to the minimum float value--guaranteeing that they would be replaced during the first iteration.
However, there is a subtle bug here. It turns out CGFLOAT_MIN is somewhat misleading. It's not the minimum float value, but the smallest possible float value (the positive value closest to zero). So, the code should probably use -CGFLOAT_MAX (though 0.0f would also work, since weight values are always positive).
If, for whatever reason, the user entered 0 lbs for all their weights, this code would actually select CGFLOAT_MIN as the maximum weight. Of course, it would be rounded to 0 in the view--so it doesn't have a major impact. But, technically it's wrong.

Duh! I scare myself sometimes. Don't know how I didn't see that logic right off the bat, but with your explanation it now makes perfect sense. Thanks!

Would you please explain why you set minWeight to CGFLOAT_MAX (i.e., min to MAX) and maxWeight to CGFLOAT_MIN (i.e., max to MIN)? Thanks