Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!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.017 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'subject:not': 0.03; 'context': 0.07; 'filing': 0.07; 'indicates': 0.09; 'trailing': 0.09; 'hardcopy': 0.16; 'precision,': 0.16; 'precision.': 0.16; 'removed,': 0.16; 'subject:format': 0.16; 'zero.': 0.16; 'zeros': 0.16; 'wrote:': 0.18; 'numerical': 0.19; 'thu,': 0.19; 'feb': 0.22; '>>>': 0.22; 'removed.': 0.24; 'header:In-Reply-To:1': 0.27; 'point': 0.28; 'am,': 0.29; 'have,': 0.30; 'message- id:@mail.gmail.com': 0.30; '13,': 0.31; 'doc': 0.31; 'libraries': 0.31; 'supposed': 0.32; 'says': 0.33; 'fri,': 0.33; 'could': 0.34; 'received:209.85': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'received:209': 0.37; 'somebody': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'explain': 0.39; '12,': 0.39; 'subject:" ': 0.39; 'to:addr:python.org': 0.39; 'ian': 0.60; 'within': 0.65; 'due': 0.66; 'between': 0.67; '2015': 0.84; 'cabinet': 0.84; 'fish': 0.84; 'fourth': 0.84; 'edwards': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; bh=1tpw0dx9FnC989dxlEc47m0Sdil9tbu/T8YGZ66Wdow=; b=ed0QXaQCw4KRNRGHgaPu8Ul2HAji3TYMiH3QY/Z68P/bUMpGvL4tDrb5WkrQaKHlzP A/TypyE5biG5HFem3lRx+WkvwCcmrR4MYjuKf5RQwQB8d8E6zlXOiNHhGRCu+I4BoQ+o SPSTy0xamR6ktapxX+sVZIUAZGKvKYbyAr+1UFeuPWs+FjyGYzITbK8ClPjyojZe+8Sl Ng65ebOsklzHPjYfpgQsVx6MH2eP8Sx028AuuniQwCXGEFwDLbPvOaprAWY+0+WltgOP sepeKzf15FQE09QKsI6BYk2EuYqTnSk6yjV8ThS+fTyyE+D8XGRUkJV1ftM92U+NgA/p pzBg== X-Received: by 10.66.97.106 with SMTP id dz10mr17304734pab.66.1423846628593; Fri, 13 Feb 2015 08:57:08 -0800 (PST) MIME-Version: 1.0 In-Reply-To: References: From: Ian Kelly Date: Fri, 13 Feb 2015 09:56:28 -0700 Subject: Re: Floating point "g" format not stripping trailing zeros To: Python Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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: 22 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1423846637 news.xs4all.nl 2972 [2001:888:2000:d::a6]:50665 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:85652 On Fri, Feb 13, 2015 at 7:02 AM, Grant Edwards wr= ote: > On 2015-02-12, Ian Kelly wrote: >> On Thu, Feb 12, 2015 at 1:23 PM, Hrvoje Nik=C5=A1i=C4=87 wrote: >> >>> {:.15g} is supposed to give 15 digits of precision, but with trailing >>> zeros removed. >> >> The doc says with "insignificant" trailing zeros removed, not all >> trailing zeros. > > Can somebody explain the difference between "significant" and > "insignificant" tailing zeros to somebody who barely passed his single > numerical methods class? [Though I have, on occasion, had to tinker > with the innards of SW floating point libraries and could fish a > hardcopy of IEEE-754 out of a filing cabinet if needed.] Significant digits are within the precision of the calculation. Writing 1.230 indicates that the fourth digit is known to be zero. Writing 1.23 outside a context of exact calculation indicates that the fourth digit is unknown due to insufficient precision.