NSString is @"16.240"
it's doubleValue is 16.239999999999998
What happened behind the scenes?
NSString is @"16.240"
it's doubleValue is 16.239999999999998
What happened behind the scenes?
If it is value for price (or money in general) better to use NSDecimalNumber
because it is save each part of float value as is.
NSDecimalNumber *price = [NSDecimalNumber decimalNumberWithString:@"16.240"];
NSLog(price); //16.24
http://rypress.com/tutorials/objective-c/data-types/nsdecimalnumber