Jerry Chan
Jerry Chan

Reputation: 49

objective-c invalid operands to binary expression double to double

-(double) pixelDistance:(float)lat1 Lng1:(float)lng1 Lat2:(float)lat2 Lng2:(float)lng2 Zoom:(double)zoom{
    double x1 = [self lngToX:lng1];
    double y1 = [self latToY:lat1];

    double x2 = [self lngToX:lng2];
    double y2 = [self latToY:lat2];
    return sqrt(pow((x1-x2),2)+ pow((y1-y2),2)) >> (21 - zoom);
}

how to fix "invalid operands to binary expression double to double"? error at return line.

Upvotes: 0

Views: 911

Answers (1)

rmaddy
rmaddy

Reputation: 318854

The right shift operator >> requires two integer arguments, not two double arguments.

Upvotes: 2

Related Questions