From bad4e025d7700bc2898e9a59f20a05f899e8a7b2 Mon Sep 17 00:00:00 2001 From: Daniel Gazzoli Nunes Date: Fri, 12 Mar 2021 14:18:02 -0300 Subject: [PATCH] Update GeoHash.cs --- NGeoHash/GeoHash.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/NGeoHash/GeoHash.cs b/NGeoHash/GeoHash.cs index ac3a80f..3eb008b 100644 --- a/NGeoHash/GeoHash.cs +++ b/NGeoHash/GeoHash.cs @@ -246,12 +246,12 @@ public static BoundingBox DecodeBboxInt(long hashInt, int bitDepth = 52) var maxLon = 180D; var minLon = -180D; - var step = bitDepth / 2; + var step = (double)bitDepth / 2; for (var i = 0; i < step; i++) { - var lonBit = DecodeBit(hashInt, (step - i) * 2 - 1); - var latBit = DecodeBit(hashInt, (step - i) * 2 - 2); + var lonBit = DecodeBit(hashInt, (int)Math.Round((step - i) * 2 - 1)); + var latBit = DecodeBit(hashInt, (int)Math.Round((step - i) * 2 - 2)); if (latBit == 0) { maxLat = (maxLat + minLat) / 2;