Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #85657
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!nntp.club.cc.cmu.edu!micro-heart-of-gold.mit.edu!bloom-beacon.mit.edu!bloom-beacon.mit.edu!panix!not-for-mail |
|---|---|
| From | Grant Edwards <invalid@invalid.invalid> |
| Newsgroups | comp.lang.python |
| Subject | Re: Floating point "g" format not stripping trailing zeros |
| Date | Fri, 13 Feb 2015 20:33:16 +0000 (UTC) |
| Organization | PANIX Public Access Internet and UNIX, NYC |
| Lines | 32 |
| Message-ID | <mbln2c$9k5$1@reader1.panix.com> (permalink) |
| 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> |
| NNTP-Posting-Host | 67-130-15-94.dia.static.qwest.net |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | 8bit |
| X-Trace | reader1.panix.com 1423859596 9861 67.130.15.94 (13 Feb 2015 20:33:16 GMT) |
| X-Complaints-To | abuse@panix.com |
| NNTP-Posting-Date | Fri, 13 Feb 2015 20:33:16 +0000 (UTC) |
| User-Agent | slrn/1.0.1 (Linux) |
| Xref | csiph.com comp.lang.python:85657 |
Show key headers only | View raw
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.
--
Grant Edwards grant.b.edwards Yow! Mr and Mrs PED, can I
at borrow 26.7% of the RAYON
gmail.com TEXTILE production of the
INDONESIAN archipelago?
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