NSPredicate dont work with double values (%f)?
it works fine with long float, %lf
Don't ever use ==
to compare floating point values.
If you want to find objects with a "specific" value, compare against a small range. Otherwise, floating-point representation error will bite you.
So consider using:
const float epsilon = 0.000001;
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"latitude > %f AND latitude < %f AND longitude > %f AND longitude < %f", coordinate.latitude - epsilon, coordinate.latitude + epsilon, coordinate.longitude - epsilon, coordinate.longitude + epsilon];
It's because the precision of floats is not 100%. So you could also do this:
[NSPredicate predicateWithFormat:@"abs(latitude - %f) < 0.0001 AND abs(longitude - %f) < 0.0001", coordinate.latitude, coordinate.longitude]