Ok, this makes absolutely no sense:
I creat an NSNumber:
NSNumber *n = [NSNumber numberWithInt:37669178];
I then echo the value as an integer and a float:
int i = [n intValue];
float f = [n floatValue];
Here are their values:
int: 37669178
float: 37669176.000000
Huh!?!?!
Could someone please explain to me why this is happening and how to get around it. This surely cannot be a precision issue. 37,669,178 is well within the precision of a float.
Thanks,
Doug
UPDATE
OK, Now I'm totally confused. Refering to math.h
define MAXFLOAT ((float)3.40282346638528860e+38)
Integer value 37669178 is 3.7669178e+7, well within the maximum allowable floating point value. So, [n floatValue] should return 37669178.0 not 37669176.0
What am I missing here?