mozilla/ichnaea — pull request #271 by graydon (2014-07-09 21:24:08+00:00)
Title: Bug 267 floating point coords

This changes the coordinate system of Ichnaea to (primarily) use double precision floating point in the database and python native floats in memory. The "primarily" here refers to a minor caveat that mapstats are bucketed into tiles at a resolution of thousandths-of-a-degree (about 110m at the equator), and the "coordinates" for these tiles are thus integer counts. Everything else is doubles.

Python floats are officially C doubles (https://github.com/python-git/python/blob/master/Include/floatobject.h#L16) and I confirmed that on a 64bit build of python 2.6.9, there are 53 bits of mantissa, it's a double:

``
sys.floatinfo(max=1.7976931348623157e+308, max_exp=1024, max_10_exp=308, min=2.2250738585072014e-308, min_exp=-1021, min_10_exp=-307, dig=15, mant_dig=53, epsilon=2.2204460492503131e-16, radix=2, rounds=1)
``

I attempted a further experimental change to using 32bit floats in the database, to see if we were relying on the resolution of doubles, and it appears we are: several tests fail due to precision-loss. So I did not include that change in this PR.

A certain amount of this PR concerns changes to integer literals. Some of these changes were bulk-rewrites and some were done by hand; the decision of where to keep or truncate trailing zeroes is thus a bit ad-hoc and includes prosaic concerns like "minimizing re-wrapping long lines". If you like I can go through and do a bunch more literal-tidying to some more uniform style.