From 69884b607c1a2131972a708da592cbb69f785f49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paulus=20P=C3=A4rssinen?= Date: Thu, 2 May 2024 16:47:31 +0000 Subject: [PATCH] Fix error in the comment Small error in the comment. The "clamping" to unit range ``[0, 1]`` is done by dividing latitude with ``180.0`` and longitude with ``360.0``. --- src/core.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core.rs b/src/core.rs index 4e96a30..38beded 100644 --- a/src/core.rs +++ b/src/core.rs @@ -132,10 +132,10 @@ pub fn encode(c: Coord, len: usize) -> Result { return Err(GeohashError::InvalidLength(len)); } - // divides the latitude by 90, then adds 1.5 to give a value between 1 and 2 + // divides the latitude by 180, then adds 1.5 to give a value between 1 and 2 // then we take the first 32 bits of the significand as a u32 let lat32 = ((c.y * 0.005555555555555556 + 1.5).to_bits() >> 20) as u32; - // same as latitude, but a division by 180 instead of 90 + // same as latitude, but a division by 360 instead of 180 let lon32 = ((c.x * 0.002777777777777778 + 1.5).to_bits() >> 20) as u32; let mut interleaved_int = interleave(lat32, lon32);