Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder4.news.weretis.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.021 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'say,': 0.05; 'float': 0.07; 'cc:addr:python-list': 0.11; 'python': 0.11; 'after,': 0.16; 'coordinates': 0.16; 'empty,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'given,': 0.16; 'left,': 0.16; 'losing': 0.16; 'roy': 0.16; ':-)': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'trying': 0.19; 'figures': 0.19; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; "i've": 0.25; 'least': 0.26; 'values': 0.27; 'header:In-Reply-To:1': 0.27; 'point': 0.28; 'appear': 0.29; 'chris': 0.29; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; '(which': 0.31; 'getting': 0.31; 'decimal': 0.31; 'received:google.com': 0.35; 'false': 0.36; 'in.': 0.36; 'subject:?': 0.36; 'wrong': 0.37; 'starting': 0.37; 'handle': 0.38; 'pm,': 0.38; 'greatest': 0.60; 'worry': 0.60; "you're": 0.61; 'first': 0.61; 'chance': 0.65; '30,': 0.65; 'within': 0.65; 'smith': 0.68; '10%': 0.74; 'article': 0.77; 'glass': 0.84; 'ten,': 0.84; 'to:none': 0.92 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=T0zFJYBeo9lTC36kHWg6Tfye+8yGrl6djh54NtmONP0=; b=mgiWLqRmN4T31wap6GDi4LoNOuapykVSH8+y3XgSJqf06Qt4k8mb0UiOA/08ELyOOS s33ecfR481OYmhcKuVlUZ9AWZc8Y/uLWc3g7jpuGmL1rDJ+8doEYv8zgosTLYw+gE8WE cBewPWbcU3AbzwM4XLo5RQTjjk98Y5q9IueytvShIUQPR50PSeSF0ugJvTf9+uEiAqkl UprNuGwNZV+NeyEK2goCdqh+LaC+7ajXWr1GvJv08uk4cZmcnY2EJ+AZag2jTzn1M2eL KgSMZT9qS8JQLV10BzLC1SvZENqKdO2gf7puYlxrhkw8z8GLdAOeYc5WZx0gE+I/CsEu 6bjw== MIME-Version: 1.0 X-Received: by 10.221.20.199 with SMTP id qp7mr788325vcb.24.1398816789062; Tue, 29 Apr 2014 17:13:09 -0700 (PDT) In-Reply-To: References: <535f0f9f$0$29965$c3e8da3$5496439d@news.astraweb.com> Date: Wed, 30 Apr 2014 10:13:08 +1000 Subject: Re: Significant digits in a float? From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 29 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1398816797 news.xs4all.nl 2872 [2001:888:2000:d::a6]:50226 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:70740 On Wed, Apr 30, 2014 at 9:53 AM, Roy Smith wrote: > In article , > Chris Angelico wrote: > >> On Tue, Apr 29, 2014 at 11:38 PM, Roy Smith 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? > > You're looking at it the wrong way. It's not that the glass is 10% > empty, it's that it's 90% full, and 90% is a lot of good data :-) Hah! That's one way of looking at it. At least you don't have to worry about junk digits getting in. The greatest precision you're working with is three digits before the decimal and four after, and a Python float can handle that easily. (Which is what I was concerned about when I first queried your terminology - four digits to the right of the decimal and, say, 10-12 to the left, and you're starting to see problems.) ChrisA