Skip to content

Commit 3e58a3d

Browse files
author
hiroaki.kawai
committed
fix issue 12
1 parent dfccad9 commit 3e58a3d

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/geohash.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ static inline int double_to_i64(double in, uint64_t *out){
103103
if(shift > 0){
104104
x.i64 <<= shift;
105105
}else{
106-
x.i64 >>= shift;
106+
x.i64 >>= -shift;
107107
}
108108
if(sign){
109109
x.i64 = UINT64_C(0x8000000000000000) - x.i64;

test/test_geohash.py

+5
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ def test_ezs42(self):
5858
x=geohash.bbox('ezs42')
5959
self.assertEqual(round(x['s'],3), 42.583)
6060
self.assertEqual(round(x['n'],3), 42.627)
61+
62+
def test_issue12(self):
63+
ll=geohash.decode(geohash.encode(51.566141,-0.009434,24))
64+
self.assertAlmostEqual(ll[0], 51.566141)
65+
self.assertAlmostEqual(ll[1], -0.009434)
6166

6267
class TestNeighbors(unittest.TestCase):
6368
def test_empty(self):

0 commit comments

Comments
 (0)