Live data from Hacker News

The lat/lon floating point delusion

datafix.com.au

11–20 of 154 posts

Re: The lat/lon floating point delusion

#12
post #2

Did the author think about the implementation? If we assign semantic meaning to the number of decimal points, now we also need to store the number of significant digits side by side with the actual number. We shouldn't round off internally because we might use it in as an intermediate result in a calculation.

> We shouldn't round off internally because we might use it in as an intermediate result in a calculation. Only if the precision is meaningful. The author's point is that it isn't for geographical coordinates.

Error tends to grow as the calculation proceeds. 6th-decimal "insignificant rounding" done over and over as the calculation proceeds can grow to become arbitrarily large.

Re: The lat/lon floating point delusion

#13
post #8

I find it hard to get that worked up about this. The positions are accurate at least, and if you're really so hard up for space that saving a couple of digits is going to make all the difference then you can think about it for 5 mins and choose a precision/storage trade off that's appropriate for you.

The representation of the numbers doesn't convey any information about accuracy, and it's at least a good practice to store data in a way that conveys the precision it was gathered with.

Re: The lat/lon floating point delusion

#14
The author also ignores the fact that the distance associated with a degree of longitude changes dramatically as you go from the equator (69m/111km) to the poles (0) - roughly as a cosine. So the number of decimal places of longitude should shrink as you get further from the equator.

https://www.thoughtco.com/degree-of-latitude-and-longitude-d...

"At 40 degrees north or south, the distance between a degree of longitude is 53 miles (85 kilometers)."

So while it's appropriate for Melbourne (37.8S) to use (very slightly) lower precision than Sydney (33.9S), they're both using too many digits.

Re: The lat/lon floating point delusion

#16
post #8

I find it hard to get that worked up about this. The positions are accurate at least, and if you're really so hard up for space that saving a couple of digits is going to make all the difference then you can think about it for 5 mins and choose a precision/storage trade off that's appropriate for you.

The representation of the numbers doesn't convey any information about accuracy, and it's at least a good practice to store data in a way that conveys the precision it was gathered with.

The issue then is that there is no reasonable primitive format to store a “real number with a small decimal precision”. Arguably storing these as ints would be better but then everybody would need to agree on the denominator.

Re: The lat/lon floating point delusion

#18

Earlier quoted context omitted.

> We shouldn't round off internally because we might use it in as an intermediate result in a calculation. Only if the precision is meaningful. The author's point is that it isn't for geographical coordinates.

Error tends to grow as the calculation proceeds. 6th-decimal "insignificant rounding" done over and over as the calculation proceeds can grow to become arbitrarily large.

Which calculation on lat/lon coordinates would make an atom-scale error grow, say, a million times to millimeter-size?

Re: The lat/lon floating point delusion

#19

Earlier quoted context omitted.

> We shouldn't round off internally because we might use it in as an intermediate result in a calculation. Only if the precision is meaningful. The author's point is that it isn't for geographical coordinates.

Error tends to grow as the calculation proceeds. 6th-decimal "insignificant rounding" done over and over as the calculation proceeds can grow to become arbitrarily large.

What numerically unstable algorithms are ever performed with geolocations?

Moreover, given the author's point that real measurement errors exceed the false precision of published data, if such a calculation were performed and did provide "arbitrarily large" error, it would indicate that the result should in fact be nonsense.

Re: The lat/lon floating point delusion

#20
Yes, why don't people spend their time doing the extra work to figure out the exact number of meaningful digits in their measurements when the defaults work just fine for their non-scientific, non-metrological purposes?

A mystery for the ages.

Post reply on HN