Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder5.xlned.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: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.090 X-Spam-Evidence: '*H*': 0.82; '*S*': 0.00; '0.1': 0.09; 'subject:question': 0.10; 'python': 0.11; "(i'm": 0.16; '0.3': 0.16; 'all.': 0.16; 'thanks,': 0.17; 'header:User-Agent:1': 0.23; 'precise': 0.24; 'cheers,': 0.24; "i've": 0.25; 'wondering': 0.29; "i'm": 0.30; "skip:' 10": 0.31; 'closer': 0.31; 'fedora': 0.31; 'received:google.com': 0.35; 'i.e.': 0.36; 'subject:Simple': 0.36; 'ubuntu': 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; 'first': 0.61; 'header:Reply-To:1': 0.67; '20,': 0.68; 'reply-to:no real name:2**0': 0.71; 'london,': 0.72; 'reply-to:addr:gmail.com': 0.80; '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:content-type:content-transfer-encoding; bh=AgsXjEuQ+UbaIR/g0H1b6/MOMJ+Yl5bhkCAN1ctogio=; b=XXi6qgCrn8tBYjh4pxToh94AVFjzekEEYoyeoIwfnjFJ1dTS5HAk1UFWcNeRg5FSiJ F4rtCCjcbUWAPvfufe5Df5uIMUPA8YkYGq0QAbaLg5cP0GEfmnKVov0+txhkGPqmK9P8 jhAOYMyGYf5MylVgxogvS9J/pJytLWyn2lrGa1T3S9kvM9jqEMdL91940MBRCZv89H/q OaOPPkNuJKzxXEQozlnBaRJHx6nqdENPKOiI5QhVhK6all4ybx8fpU7ISf/4tnCh6rtI v5NX0WfeRtHP2E4XgQd24dEfLCUaX5OnqAWI++1BgMCIkEaiLuNZ2NMzvj79l5QgATDt 9u4w== X-Received: by 10.180.20.176 with SMTP id o16mr15619671wie.7.1397585929520; Tue, 15 Apr 2014 11:18:49 -0700 (PDT) Date: Tue, 15 Apr 2014 19:18:47 +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: Simple question 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: 27 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1397585937 news.xs4all.nl 2830 [2001:888:2000:d::a6]:56943 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:70277 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? Many thanks, 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