mirror of
https://github.com/fluencelabs/redis
synced 2025-03-19 17:10:50 +00:00
Merge pull request #3101 from itamarhaber/geohumanized
Fixes double conversions in GEO
This commit is contained in:
commit
438ae496af
12
src/geo.c
12
src/geo.c
@ -163,7 +163,7 @@ double extractDistanceOrReply(client *c, robj **argv,
|
|||||||
return distance * to_meters;
|
return distance * to_meters;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The defailt addReplyDouble has too much accuracy. We use this
|
/* The default addReplyDouble has too much accuracy. We use this
|
||||||
* for returning location distances. "5.2145 meters away" is nicer
|
* for returning location distances. "5.2145 meters away" is nicer
|
||||||
* than "5.2144992818115 meters away." We provide 4 digits after the dot
|
* than "5.2144992818115 meters away." We provide 4 digits after the dot
|
||||||
* so that the returned value is decently accurate even when the unit is
|
* so that the returned value is decently accurate even when the unit is
|
||||||
@ -588,8 +588,8 @@ void georadiusGeneric(client *c, int type) {
|
|||||||
|
|
||||||
if (withcoords) {
|
if (withcoords) {
|
||||||
addReplyMultiBulkLen(c, 2);
|
addReplyMultiBulkLen(c, 2);
|
||||||
addReplyDouble(c, gp->longitude);
|
addReplyHumanLongDouble(c, gp->longitude);
|
||||||
addReplyDouble(c, gp->latitude);
|
addReplyHumanLongDouble(c, gp->latitude);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -726,8 +726,8 @@ void geoposCommand(client *c) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
addReplyMultiBulkLen(c,2);
|
addReplyMultiBulkLen(c,2);
|
||||||
addReplyDouble(c,xy[0]);
|
addReplyHumanLongDouble(c,xy[0]);
|
||||||
addReplyDouble(c,xy[1]);
|
addReplyHumanLongDouble(c,xy[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -767,6 +767,6 @@ void geodistCommand(client *c) {
|
|||||||
if (!decodeGeohash(score1,xyxy) || !decodeGeohash(score2,xyxy+2))
|
if (!decodeGeohash(score1,xyxy) || !decodeGeohash(score2,xyxy+2))
|
||||||
addReply(c,shared.nullbulk);
|
addReply(c,shared.nullbulk);
|
||||||
else
|
else
|
||||||
addReplyDouble(c,
|
addReplyDoubleDistance(c,
|
||||||
geohashGetDistance(xyxy[0],xyxy[1],xyxy[2],xyxy[3]) / to_meter);
|
geohashGetDistance(xyxy[0],xyxy[1],xyxy[2],xyxy[3]) / to_meter);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user