Skip to main content

decode

Function decode 

Source
pub fn decode(raw: f64) -> Option<(f64, f64)>
Expand description

The point a score decodes to, which is the middle of the box it names.

This never fails on anything that came out of score. It takes an f64 because that is what the sorted set holds and a score that is not a whole number in range was not written by us.

A score is fifty two bits everywhere except at the two far edges. A point at longitude 180 exactly scales to bucket 1 << 26, which is one past the twenty six bits the axis has, and the same happens at the top latitude, so those two scores carry a fifty third and a fifty fourth bit. Redis stores them like that and reads them back the same way, so the limit here is what a full score can reach and not what it usually is. Refusing them left GEOPOS answering nothing for a point on the date line.