Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #85661
| Path | csiph.com!usenet.pasdenom.info!gegeweb.org!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed4a.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.038 |
| X-Spam-Evidence | '*H*': 0.93; '*S*': 0.00; 'programmer': 0.03; 'subject:not': 0.03; 'lesser': 0.07; 'trailing': 0.09; '1.20': 0.16; 'measured': 0.16; 'subject:format': 0.16; 'url:decimal': 0.16; 'zeros': 0.16; 'wrote:': 0.18; 'module': 0.19; 'figures': 0.19; 'written': 0.21; 'feb': 0.22; '>>>': 0.22; 'appears': 0.22; 'instance,': 0.24; 'possibly': 0.26; 'header:In-Reply-To:1': 0.27; 'message-id:@mail.gmail.com': 0.30; 'gives': 0.31; 'url:wiki': 0.31; '1.3': 0.31; '13,': 0.31; 'decimal': 0.31; 'url:wikipedia': 0.31; 'url:python': 0.33; 'fri,': 0.33; 'could': 0.34; 'agree': 0.35; 'received:209.85': 0.35; 'received:google.com': 0.35; 'url:org': 0.36; 'received:209': 0.37; 'url:library': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'that,': 0.38; 'subject:" ': 0.39; 'to:addr:python.org': 0.39; 'either': 0.39; 'how': 0.40; 'dave': 0.60; 'tell': 0.60; 'places': 0.64; 'kept': 0.65; 'skip:\xe2 10': 0.65; '2015': 0.84; 'angel': 0.91; 'edwards': 0.91; 'notion': 0.91; 'hand,': 0.93; 'taught': 0.96 |
| 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=fNuax+Qe82vuUl13sfmZdhlqmIjz/7V8c0Q7trq9JO8=; b=REr09luuzBx2XeUPmQ3O9XxvN72RdjfoE5wsBXzkRpne4HQnKHD5glU0ECsQmIIEYR DM0JYZ6XH6DCox+NpYsMEITKqwafDAwZrO1UNv4uWMa977bXJTQqJ/gv+V8DmnDyB2tW 00myh9N7Qwv4Ytix6rD5jA2nD0UQspTVosaYkTZBU25OBIuJDCLqexrTRvfQSvNHzzDj A9JCXGDo1sulTyBRc8WfD8zhQkhlUvGYZjDxBxLRalTl4dfH+Hx9rG4PtfOYuzup3rRE 6Ij4D3aVvzhxJbGauuVaJ94F28UwG8zZ9Mj80BeceuWEVqh1NPYliTYwa1Whabo4sMUy ye+g== |
| X-Received | by 10.66.124.225 with SMTP id ml1mr9882436pab.142.1423863641348; Fri, 13 Feb 2015 13:40:41 -0800 (PST) |
| MIME-Version | 1.0 |
| In-Reply-To | <mblpv0$2v6$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> <mailman.18734.1423862121.18130.python-list@python.org> <mblpv0$2v6$1@reader1.panix.com> |
| From | Ian Kelly <ian.g.kelly@gmail.com> |
| Date | Fri, 13 Feb 2015 14:40:01 -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.18735.1423863651.18130.python-list@python.org> (permalink) |
| Lines | 37 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1423863651 news.xs4all.nl 2845 [2001:888:2000:d::a6]:60743 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:85661 |
Show key headers only | View raw
On Fri, Feb 13, 2015 at 2:22 PM, Grant Edwards <invalid@invalid.invalid> wrote:
> On 2015-02-13, Dave Angel <davea@davea.name> wrote:
>> On the other hand, the Decimal package has a way that the programmer
>> can tell how many digits to use at each stage of the calculation.
>
> That's what surpised me. From TFM:
>
> https://docs.python.org/2/library/decimal.html:
>
> * The decimal module incorporates a notion of significant places so that
> 1.30 + 1.20 is 2.50. The trailing zero is kept to indicate
> significance. This is the customary presentation for monetary
> applications. For multiplication, the “schoolbook” approach uses
> all the figures in the multiplicands. For instance, 1.3 * 1.2 gives
> 1.56 while 1.30 * 1.20 gives 1.5600.
Huh. That approach for multiplication is definitely not what I was
taught in school. I was taught that the number of significant digits
in the product is the lesser of the number of significant digits in
either of the measured multiplicands. So 1.30 * 1.20 would be 1.56,
while 1.3 * 1.2 would just be 1.6. Wikipedia appears to agree with me:
http://en.wikipedia.org/wiki/Significance_arithmetic#Multiplication_and_division_using_significance_arithmetic
Moreover:
>>> D('1.304') * D('1.204')
Decimal('1.570016')
>>> D('1.295') * D('1.195')
Decimal('1.547525')
So 1.30 * 1.20 could be written approximately as 1.56 ± 0.01. Given
that, I don't understand how the trailing zeros in 1.5600 could
possibly be considered significant.
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