Significant digits in a float?

Chris Angelico rosuav at gmail.com
Tue Apr 29 12:30:12 EDT 2014


On Tue, Apr 29, 2014 at 11:38 PM, Roy Smith <roy at panix.com> wrote:
> I'm trying to intuit, from the values I've been given, which coordinates
> are likely to be accurate to within a few miles.  I'm willing to accept
> a few false negatives.  If the number is float("38"), I'm willing to
> accept that it might actually be float("38.0000"), and I might be
> throwing out a good data point that I don't need to.

You have one chance in ten, repeatably, of losing a digit. That is,
roughly 10% of your four-decimal figures will appear to be
three-decimal, and 1% of them will appear to be two-decimal, and so
on. Is that "a few" false negatives? It feels like a lot IMO. But
then, there's no alternative - the information's already gone.

ChrisA



More information about the Python-list mailing list