Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #12812

Floating point multiplication in python

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!feeder.news-service.com!xlned.com!feeder7.xlned.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!194.109.133.85.MISMATCH!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <xyzhtml@163.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.176
X-Spam-Level *
X-Spam-Evidence '*H*': 0.70; '*S*': 0.05; 'python': 0.08; 'subject:python': 0.11; '1.1': 0.16; 'received:172.21': 0.16; 'x-mailer:apple mail (2.1084)': 0.16; '>>>': 0.18; 'all:': 0.23; 'message-id:@163.com': 0.30; 'to:addr:python-list': 0.33; 'charset :us-ascii': 0.36; 'subject:skip:m 10': 0.37; 'but': 0.37; 'header :Mime-Version:1': 0.39; 'why': 0.39; 'to:addr:python.org': 0.39; 'header:Message-Id:1': 0.61; 'received:220.181': 0.62; 'from:addr:163.com': 0.63; 'received:163.com': 0.63; 'skip:1 10': 0.63; '1.21': 0.84; 'received:220.181.12': 0.97
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=Received:From:Content-Type: Content-Transfer-Encoding:Subject:Date:Message-Id:To: Mime-Version; bh=m88Mnwi6kD7SnNKvSOjK1HfAN+LP5qVqJqArO7gwouA=; b=ZCDB7MuCIg/44GIVrDlXURprv3peNQr2g6UZTGvu0qIYi2XiwRyggK+Q4gjGSE 3hKJL5Ij7fu5pSLNNZHiOEfDlSaQ23DuQSm+s+OT7ke0kqW3ZkqBm6Tb8S0TxABe 7UdON/AjW+X/CUC8JIP0VX6hvjCRyFAycwr1vRQAaM6Fo=
From xyz <xyzhtml@163.com>
Content-Type text/plain; charset=us-ascii
Content-Transfer-Encoding quoted-printable
Subject Floating point multiplication in python
Date Tue, 6 Sep 2011 13:57:31 +0800
To python-list@python.org
Mime-Version 1.0 (Apple Message framework v1084)
X-Mailer Apple Mail (2.1084)
X-CM-TRANSID EcCowGC5VkBEtmVO9Dg9AA--.53234S2
X-Coremail-Antispam 1Uf129KBjDUn29KB7ZKAUJUUUUU529EdanIXcx71UUUUU7v73 VFW2AGmfu7bjvjm3AaLaJ3UbIYCTnIWIevJa73UjIFyTuYvjxU1rWFUUUUU
X-CM-SenderInfo h012x3lpo6il2tof0z/1tbiOQuy2kjh8xaeHgAAsW
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.790.1315289581.27778.python-list@python.org> (permalink)
Lines 11
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1315289581 news.xs4all.nl 2477 [2001:888:2000:d::a6]:55825
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:12812

Show key headers only | View raw


hi all:

As we know ,  1.1 * 1.1 is 1.21 . 
But in python ,I got following :

>>> 1.1 * 1.1
1.2100000000000002

why python get wrong result? Who can tell me  where's the 0.0000000000000002 from?

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Floating point multiplication in python xyz <xyzhtml@163.com> - 2011-09-06 13:57 +0800
  Re: Floating point multiplication in python Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-09-06 17:11 +1000
  Re: Floating point multiplication in python Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2011-09-06 12:14 +0200
    Re: Floating point multiplication in python Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-09-06 18:07 +0200
      Re: Floating point multiplication in python Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-09-07 14:51 +1000
        Re: Floating point multiplication in python Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2011-09-06 23:35 -0700
        Re: Floating point multiplication in python Gelonida N <gelonida@gmail.com> - 2011-09-07 10:57 +0200
        Re: Floating point multiplication in python Terry Reedy <tjreedy@udel.edu> - 2011-09-07 05:37 -0400

csiph-web