Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.datemas.de!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed2.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.059 X-Spam-Evidence: '*H*': 0.88; '*S*': 0.00; 'verbatim': 0.07; '0.1': 0.09; 'part,': 0.09; 'subject:question': 0.10; 'python': 0.11; "(i'm": 0.16; '0.3': 0.16; 'ellipses': 0.16; 'kern': 0.16; 'all.': 0.16; 'wrote:': 0.18; '>>>': 0.22; 'header:User-Agent:1': 0.23; 'copied': 0.24; 'precise': 0.24; 'cheers,': 0.24; "i've": 0.25; 'header:In-Reply-To:1': 0.27; 'wondering': 0.29; 'robert': 0.30; "i'm": 0.30; "skip:' 10": 0.31; 'closer': 0.31; 'fedora': 0.31; 'purely': 0.31; 'no,': 0.35; 'received:google.com': 0.35; 'i.e.': 0.36; 'subject:Simple': 0.36; 'ubuntu': 0.36; 'done': 0.36; 'thanks': 0.36; 'hi,': 0.36; 'url:org': 0.36; 'message- id:@gmail.com': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'skip:u 10': 0.60; 'lost': 0.61; 'first': 0.61; 'header:Reply-To:1': 0.67; '20,': 0.68; 'book,': 0.68; 'reply-to:no real name:2**0': 0.71; 'london,': 0.72; 'reply- to:addr:gmail.com': 0.80; 'phil': 0.84; 'replied.': 0.84; 'snow': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:reply-to:organization:user-agent:mime-version :to:subject:references:in-reply-to:content-type :content-transfer-encoding; bh=m5lorFT2Nxv57I1xN5pKuYaBIbmfkcyty2s5b1RZbxw=; b=vJi/RGk/gmkjUJ9jhYc7kuB5ayth5raEtRl16lBkwRDWtQaUL3ds9mKkOd2inmra3b uwsrNg2TWSW9RWhIeLccC90cszQEMpRN51uAXo7Gmj0S7W840o0C6RkMldrxPecWWfk8 Jgd0x6C/VzV4Z3AjHKdAuU1VLJ4dww3FVjmHr3YVwma36ElWGVmmO3tDFwFAzr9D4zIm h7QN3V5EHbHVVHKSitp/LDDK2sTKZfpOsFN01F1vBpOe5Yrx6E/m9qR5wJIWLJCbW0z7 AHZMO7refWxxUTMmavLxmTaWZjF7OxlTeDRsI7oRhxY8y6GtxxRj23Q7m0E8VI654Kqb qTxA== X-Received: by 10.180.73.137 with SMTP id l9mr3844126wiv.40.1397587126249; Tue, 15 Apr 2014 11:38:46 -0700 (PDT) Date: Tue, 15 Apr 2014 19:38:43 +0100 From: Phil Dobbin Organization: Horse Latitudes Ltd User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Simple question References: <534D7807.6050408@gmail.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: phildobbin@gmail.com 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: 44 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1397587127 news.xs4all.nl 2864 [2001:888:2000:d::a6]:52600 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:70285 On 15/04/2014 19:30, Robert Kern wrote: > On 2014-04-15 19:18, Phil Dobbin wrote: >> Hi, all. >> >> I've just started to learn Python (I'm reading Mark Lutz's 'Learning >> Python' from O'Reilly) & I'm confused as to this part: >> >> '>>> 0.1 + 0.1 + 0.1 - 0.3 >> 5.55111.....' >> >> Using 'import Decimal' you can get a much closer result i.e. >> 'Decimal('0.0')' >> >> What I'm wondering is why the first calculation that arrives at >> '5.55111...' is so far out? > > The `...` elides the exponent: > > >>> 0.1 + 0.1 + 0.1 - 0.3 > 5.551115123125783e-17 > > If you copied that verbatim directly out of a book, that's just sloppy > editing. > No, the ellipses are sloppy editing on my part done purely for brevity. Unfortunately they elided the relevant part, the meaning of which was, prior to these conversations, lost on me. Thanks to all who replied. Cheers, Phil... -- currently (ab)using CentOS 6.5, Debian Squeeze & Wheezy, Fedora 19 & 20, OS X Snow Leopard, RHEL 7, Ubuntu Precise & Saucy GnuGPG Key : http://phildobbin.org/publickey.asc Based in London, UK