Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed4a.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.089 X-Spam-Evidence: '*H*': 0.82; '*S*': 0.00; 'cc:addr:python-list': 0.11; 'assume': 0.14; 'question.': 0.14; 'cc:name:python list': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'roy': 0.16; 'wrote:': 0.18; '(but': 0.19; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'point': 0.28; 'leave': 0.29; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; 'bunch': 0.31; 'decimal': 0.31; 'question:': 0.31; 'values.': 0.31; 'problem': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'really': 0.36; 'minutes,': 0.36; 'subject:?': 0.36; 'example,': 0.37; 'skip:4 10': 0.37; 'two': 0.37; 'explain': 0.39; 'does': 0.39; 'numbers': 0.61; 'minutes': 0.67; 'between': 0.67; 'believe': 0.68; 'six': 0.68; 'smith': 0.68; "they'd": 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=emFySytOuriQrKrCKWylaV+QtY8sBPsSYKAe4+tizH4=; b=TOOqhYty42EDMkTJz5PEjh+vQvbEw1QEUFloLJgvoQvkBDsu4P/4cfClpoUX9AZHt+ UW7Dul5qO7WHrJk6YkjRSdKMK0hloNcOfr/hpEKbVSBcy+Uw65FUrHQris4G1uE2Cu+p rWcZtR2YEqeax0NVB5sx1gm8pvc7LqOXqpo/DXE7GRBZDKzQTmithvpb1jQvKjYV6VRi egyOq4p0TmXnsbpWRnXwMl0N5yvO0+Ye4PDVpTgSRxnqVuhYL91WSHzCzrS9b85JTHs/ 4k06ve3WArR0noF7cZ2yOts58sHDa/n5FYw+kXiiE1GJGzphOjhV0PhHYEOs8GsJKjZD 8IvA== MIME-Version: 1.0 X-Received: by 10.220.147.16 with SMTP id j16mr24534568vcv.14.1398702539580; Mon, 28 Apr 2014 09:28:59 -0700 (PDT) In-Reply-To: References: Date: Tue, 29 Apr 2014 02:28:59 +1000 Subject: Re: Significant digits in a float? From: Chris Angelico Cc: Python List 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: 26 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1398702541 news.xs4all.nl 2893 [2001:888:2000:d::a6]:51643 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:70684 On Tue, Apr 29, 2014 at 2:00 AM, Roy Smith wrote: > I have a bunch of floating point values. For example, here's a few (printed as reprs): > > 38.0 > 41.2586 > 40.75280000000001 > 49.25 > 33.795199999999994 > 36.837199999999996 > 34.1489 > 45.5 > > Fundamentally, these numbers have between 0 and 4 decimal digits of precision... Terminology question: Why do you count only what's after the decimal point? I would describe these as having between 2 and 6 significant figures. Will they always have two digits before the decimal, or does your precision really care only about what's after it? Of course, there would still remain the problem of describing 49.25 with 6 sig figs, in the same way that it's hard to explain to someone that you really do need to leave in five minutes (but if you said you had to leave in six minutes, they'd believe you to be accurate to the minute). But I assume that's not part of the question. ChrisA