Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #85658
| Path | csiph.com!usenet.pasdenom.info!gegeweb.org!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <ian.g.kelly@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.004 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'subject:not': 0.03; 'context': 0.07; 'explicit': 0.07; 'filing': 0.07; 'float': 0.07; 'formatting': 0.09; 'indicates': 0.09; 'trailing': 0.09; '(1,': 0.16; '0),': 0.16; 'exponent.': 0.16; 'hardcopy': 0.16; 'precision,': 0.16; 'precision.': 0.16; 'removed,': 0.16; 'sign,': 0.16; 'subject:format': 0.16; 'tuple': 0.16; 'zero.': 0.16; 'zeros': 0.16; 'wrote:': 0.18; 'numerical': 0.19; 'thu,': 0.19; 'feb': 0.22; '>>>': 0.22; 'possess': 0.24; 'removed.': 0.24; 'asking': 0.27; 'header:In-Reply-To:1': 0.27; 'point': 0.28; 'am,': 0.29; "doesn't": 0.30; 'have,': 0.30; 'message- id:@mail.gmail.com': 0.30; "i'm": 0.30; '13,': 0.31; '>>>>': 0.31; 'decimal': 0.31; 'doc': 0.31; 'libraries': 0.31; 'supposed': 0.32; 'says': 0.33; 'fri,': 0.33; 'could': 0.34; 'equal': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'really': 0.36; 'are,': 0.36; "didn't": 0.36; 'question,': 0.38; 'somebody': 0.38; 'to:addr :python-list': 0.38; 'pm,': 0.38; 'that,': 0.38; 'explain': 0.39; '12,': 0.39; 'realize': 0.39; 'subject:" ': 0.39; 'sure': 0.39; 'to:addr:python.org': 0.39; 'consists': 0.60; 'ian': 0.60; "you're": 0.61; 'within': 0.65; 'due': 0.66; 'between': 0.67; 'therefore': 0.72; '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=X1OhLEyVBrgPJuU6cFKrKx8V9IaspTSg0+WANH/AGOk=; b=AnhfaolpodceEfMIy4mJuugh8wD6KPz3FoFuO6G+r3LnuwwgdirrmaayoSOr6xdkb2 xKPwOvqHHNDMAQqByVZks16HxTyFSR3Tq+cUx7P6QH2Xxc2U76CourYbSxhw+pPBqJyJ hkVssdmb/BI3BNwt8+K5gMJUgXm7RmralmaWlQznqcovEw0hGXSzF7h0ecjDCPsaUfkL 6T9Ga7k7pe7Q/uk9h6yuWsBm97bNRKTFBppmpmN+XBTsG4d7l+DFVQ2yIOM/QUG7oppB h4kQP161OEdvwrCIcoAgYIiXYOTFff91s/77/Cl2+k0jKYtJ/3GWDMTvtbyp8rkC39ql iRVw== |
| X-Received | by 10.68.242.200 with SMTP id ws8mr18783234pbc.138.1423861312075; Fri, 13 Feb 2015 13:01:52 -0800 (PST) |
| MIME-Version | 1.0 |
| In-Reply-To | <mbln2c$9k5$1@reader1.panix.com> |
| References | <CAK291fpAycSecNuV6hDnVXK+rhB0CWJTAuC3BKNUz8B4aDg2kQ@mail.gmail.com> <CAK291fpKxW_V=yCvNHj9RRoEhC=i_DYJCa9-cbjxDwRwH4-KfQ@mail.gmail.com> <mailman.18715.1423784816.18130.python-list@python.org> <mbl04r$kb6$1@reader1.panix.com> <mailman.18731.1423846637.18130.python-list@python.org> <mbln2c$9k5$1@reader1.panix.com> |
| From | Ian Kelly <ian.g.kelly@gmail.com> |
| Date | Fri, 13 Feb 2015 14:01:11 -0700 |
| Subject | Re: Floating point "g" format not stripping trailing zeros |
| To | Python <python-list@python.org> |
| 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 <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.18733.1423861321.18130.python-list@python.org> (permalink) |
| Lines | 37 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1423861321 news.xs4all.nl 2855 [2001:888:2000:d::a6]:46077 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:85658 |
Show key headers only | View raw
On Fri, Feb 13, 2015 at 1:33 PM, Grant Edwards <invalid@invalid.invalid> wrote:
> On 2015-02-13, Ian Kelly <ian.g.kelly@gmail.com> wrote:
>> On Fri, Feb 13, 2015 at 7:02 AM, Grant Edwards <invalid@invalid.invalid> wrote:
>>> On 2015-02-12, Ian Kelly <ian.g.kelly@gmail.com> wrote:
>>>> On Thu, Feb 12, 2015 at 1:23 PM, Hrvoje Nikšić <hniksic@gmail.com> 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.
>
> I knew that, but I was asking in the context of float/decimal's
> formatting function. I didn't realize that float and/or decimal had a
> "significant digit" property, and therefore possess significant vs.
> insignificant trailing zeros when represented in base-10.
A Decimal object consists of a sign, a tuple of decimal digits, and an
exponent. If the digits are, e.g, (1, 2, 3, 0, 0, 0), then that would
be equal to the Decimal with the digits (1, 2, 3) and the same sign
and exponent, but the explicit presence of the trailing zeros
indicates their significance. If this doesn't answer your question,
then I'm not really sure what you're asking.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: Floating point "g" format not stripping trailing zeros Ian Kelly <ian.g.kelly@gmail.com> - 2015-02-12 16:46 -0700
Re: Floating point "g" format not stripping trailing zeros Grant Edwards <invalid@invalid.invalid> - 2015-02-13 14:02 +0000
Re: Floating point "g" format not stripping trailing zeros Ian Kelly <ian.g.kelly@gmail.com> - 2015-02-13 09:56 -0700
Re: Floating point "g" format not stripping trailing zeros Grant Edwards <invalid@invalid.invalid> - 2015-02-13 20:33 +0000
Re: Floating point "g" format not stripping trailing zeros Ian Kelly <ian.g.kelly@gmail.com> - 2015-02-13 14:01 -0700
Re: Floating point "g" format not stripping trailing zeros Dave Angel <davea@davea.name> - 2015-02-13 16:15 -0500
Re: Floating point "g" format not stripping trailing zeros Grant Edwards <invalid@invalid.invalid> - 2015-02-13 21:22 +0000
Re: Floating point "g" format not stripping trailing zeros Ian Kelly <ian.g.kelly@gmail.com> - 2015-02-13 14:40 -0700
Re: Floating point "g" format not stripping trailing zeros Ian Kelly <ian.g.kelly@gmail.com> - 2015-02-13 14:49 -0700
csiph-web