Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #70281
| 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!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.008 |
| X-Spam-Evidence | '*H*': 0.98; '*S*': 0.00; 'verbatim': 0.07; '0.1': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:question': 0.10; 'python': 0.11; "(i'm": 0.16; '0.3': 0.16; 'kern': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'underlying': 0.16; 'all.': 0.16; 'wrote:': 0.18; '>>>': 0.22; 'header:User-Agent:1': 0.23; 'copied': 0.24; 'interpret': 0.24; "i've": 0.25; 'header:X -Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'wondering': 0.29; 'robert': 0.30; "i'm": 0.30; "skip:' 10": 0.31; 'closer': 0.31; 'i.e.': 0.36; 'subject:Simple': 0.36; 'hi,': 0.36; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'first': 0.61; 'our': 0.64; 'world': 0.66; 'believe': 0.68; 'book,': 0.68; 'eco': 0.84; 'phil': 0.84; 'terrible': 0.84; 'received:86': 0.91 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Robert Kern <robert.kern@gmail.com> |
| Subject | Re: Simple question |
| Date | Tue, 15 Apr 2014 19:30:36 +0100 |
| References | <534D7807.6050408@gmail.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Gmane-NNTP-Posting-Host | cpc12-cmbg17-2-0-cust443.5-4.cable.virginm.net |
| User-Agent | Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 |
| In-Reply-To | <534D7807.6050408@gmail.com> |
| 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.9287.1397586654.18130.python-list@python.org> (permalink) |
| Lines | 30 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1397586654 news.xs4all.nl 2837 [2001:888:2000:d::a6]:38944 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:70281 |
Show key headers only | View raw
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.
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Simple question Robert Kern <robert.kern@gmail.com> - 2014-04-15 19:30 +0100
csiph-web