Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
438ae496
Commit
438ae496
authored
Feb 19, 2016
by
Salvatore Sanfilippo
Browse files
Merge pull request #3101 from itamarhaber/geohumanized
Fixes double conversions in GEO
parents
cf42c48a
b5149f08
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/geo.c
View file @
438ae496
...
@@ -163,7 +163,7 @@ double extractDistanceOrReply(client *c, robj **argv,
...
@@ -163,7 +163,7 @@ double extractDistanceOrReply(client *c, robj **argv,
return
distance
*
to_meters
;
return
distance
*
to_meters
;
}
}
/* The defa
i
lt addReplyDouble has too much accuracy. We use this
/* The defa
u
lt 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) {
...
@@ -588,8 +588,8 @@ void georadiusGeneric(client *c, int type) {
if
(
withcoords
)
{
if
(
withcoords
)
{
addReplyMultiBulkLen
(
c
,
2
);
addReplyMultiBulkLen
(
c
,
2
);
addReplyDouble
(
c
,
gp
->
longitude
);
addReply
HumanLong
Double
(
c
,
gp
->
longitude
);
addReplyDouble
(
c
,
gp
->
latitude
);
addReply
HumanLong
Double
(
c
,
gp
->
latitude
);
}
}
}
}
}
else
{
}
else
{
...
@@ -726,8 +726,8 @@ void geoposCommand(client *c) {
...
@@ -726,8 +726,8 @@ void geoposCommand(client *c) {
continue
;
continue
;
}
}
addReplyMultiBulkLen
(
c
,
2
);
addReplyMultiBulkLen
(
c
,
2
);
addReplyDouble
(
c
,
xy
[
0
]);
addReply
HumanLong
Double
(
c
,
xy
[
0
]);
addReplyDouble
(
c
,
xy
[
1
]);
addReply
HumanLong
Double
(
c
,
xy
[
1
]);
}
}
}
}
}
}
...
@@ -767,6 +767,6 @@ void geodistCommand(client *c) {
...
@@ -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
,
addReplyDouble
Distance
(
c
,
geohashGetDistance
(
xyxy
[
0
],
xyxy
[
1
],
xyxy
[
2
],
xyxy
[
3
])
/
to_meter
);
geohashGetDistance
(
xyxy
[
0
],
xyxy
[
1
],
xyxy
[
2
],
xyxy
[
3
])
/
to_meter
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment