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


Groups > comp.lang.python > #20689

Python math is off by .000000000000045

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <alec.taylor6@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.126
X-Spam-Level *
X-Spam-Evidence '*H*': 0.78; '*S*': 0.03; 'subject:Python': 0.05; 'python': 0.08; 'bug?': 0.09; 'url:95': 0.09; 'from:addr:alec.taylor6': 0.16; 'from:name:alec taylor': 0.16; '>>>': 0.18; 'received:209.85.210.174': 0.21; 'received:mail- iy0-f174.google.com': 0.21; 'math': 0.24; 'message- id:@mail.gmail.com': 0.29; 'skip:1 30': 0.29; 'subject: .': 0.29; 'thanks': 0.32; 'there': 0.33; 'to:addr:python-list': 0.35; 'received:google.com': 0.37; 'received:209.85': 0.38; 'mathematical': 0.38; 'received:209': 0.39; 'to:addr:python.org': 0.40; 'url:%0': 0.60; 'header:Received:6': 0.61; 'simple': 0.61; 'taylor': 0.67; 'url:%2b': 0.67; 'url:i': 0.74; 'url:530': 0.84; 'url:74': 0.84; 'aka': 0.91; 'only:': 0.93
Received-SPF pass (google.com: domain of alec.taylor6@gmail.com designates 10.43.133.74 as permitted sender) client-ip=10.43.133.74;
Authentication-Results mr.google.com; spf=pass (google.com: domain of alec.taylor6@gmail.com designates 10.43.133.74 as permitted sender) smtp.mail=alec.taylor6@gmail.com; dkim=pass header.i=alec.taylor6@gmail.com
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; bh=dGBoaQXkFtUEOzoYJeNIWSkwlcHl0LVpU0mg25Z7wyM=; b=O84tEdwbqiS9P83WI/mvkvC1oRQRHmNhGbSS84cMEi2zwSvOWnSw+oHV8f1+Nxumxo lUhS4r0hKPJRvXqZj5/Sv+qX67LhDsm3HrLc5QWi3EG64qUOO8awAEZCgqQFU4aV6rkX p07jU6XUeeqFAB5vukg6OKJN+YJDkws7HTzVI=
MIME-Version 1.0
Date Thu, 23 Feb 2012 05:13:17 +1100
Subject Python math is off by .000000000000045
From Alec Taylor <alec.taylor6@gmail.com>
To "comp.lang.python" <python-list@python.org>
Content-Type text/plain; charset=ISO-8859-1
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.49.1329934400.3037.python-list@python.org> (permalink)
Lines 16
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1329934400 news.xs4all.nl 6928 [2001:888:2000:d::a6]:36509
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:20689

Show key headers only | View raw


Simple mathematical problem, + and - only:

>>> 1800.00-1041.00-555.74+530.74-794.95
-60.950000000000045

That's wrong.

Proof
http://www.wolframalpha.com/input/?i=1800.00-1041.00-555.74%2B530.74-794.95
-60.95 aka (-(1219/20))

Is there a reason Python math is only approximated? - Or is this a bug?

Thanks for all info,

Alec Taylor

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


Thread

Python math is off by .000000000000045 Alec Taylor <alec.taylor6@gmail.com> - 2012-02-23 05:13 +1100
  Re: Python math is off by .000000000000045 nn <pruebauno@latinmail.com> - 2012-02-22 10:29 -0800
  Re: Python math is off by .000000000000045 Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2012-02-22 20:44 +0200
  Re: Python math is off by .000000000000045 Grant Edwards <invalid@invalid.invalid> - 2012-02-22 20:48 +0000
    Re: Python math is off by .000000000000045 Tobiah <toby@tobiah.org> - 2012-02-25 09:56 -0800
      Re: Python math is off by .000000000000045 Tim Wintle <tim.wintle@teamrubber.com> - 2012-02-25 19:08 +0000
      Re: Python math is off by .000000000000045 Terry Reedy <tjreedy@udel.edu> - 2012-02-25 16:05 -0500
        Re: Python math is off by .000000000000045 jmfauth <wxjmfauth@gmail.com> - 2012-02-25 13:25 -0800
          Re: Python math is off by .000000000000045 Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-02-25 22:51 +0000
            Re: Python math is off by .000000000000045 jmfauth <wxjmfauth@gmail.com> - 2012-02-26 01:59 -0800
              Re: Python math is off by .000000000000045 Ethan Furman <ethan@stoneleaf.us> - 2012-02-27 09:28 -0800
              Re: Python math is off by .000000000000045 Michael Torrie <torriem@gmail.com> - 2012-02-27 17:53 -0700
              Re: Python math is off by .000000000000045 Ethan Furman <ethan@stoneleaf.us> - 2012-02-28 09:56 -0800
      Re: Python math is off by .000000000000045 Devin Jeanpierre <jeanpierreda@gmail.com> - 2012-02-25 21:49 -0500
      Re: Python math is off by .000000000000045 Terry Reedy <tjreedy@udel.edu> - 2012-02-26 00:44 -0500
  Re: Python math is off by .000000000000045 John Ladasky <ladasky@my-deja.com> - 2012-02-26 16:24 -0800
    Re: Python math is off by .000000000000045 Terry Reedy <tjreedy@udel.edu> - 2012-02-26 20:30 -0500
    Re: Python math is off by .000000000000045 Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-02-27 03:28 +0000
      Re: Python math is off by .000000000000045 Grant Edwards <invalid@invalid.invalid> - 2012-02-27 15:02 +0000
        Re: Python math is off by .000000000000045 Michael Torrie <torriem@gmail.com> - 2012-02-27 08:34 -0700

csiph-web