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


Groups > comp.lang.python > #12891

Re: Floating point multiplication in python

From Terry Reedy <tjreedy@udel.edu>
Subject Re: Floating point multiplication in python
Date 2011-09-07 05:37 -0400
References <mailman.790.1315289581.27778.python-list@python.org> <j44rre$e4c$1@r03.glglgl.eu> <2204592.egLE2XKegd@PointedEars.de> <4e66f843$0$29969$c3e8da3$5496439d@news.astraweb.com>
Newsgroups comp.lang.python
Message-ID <mailman.830.1315388323.27778.python-list@python.org> (permalink)

Show all headers | View raw


On 9/7/2011 12:51 AM, Steven D'Aprano wrote:

> So given a float x, when you square it you get this:
>
> Exact values: a*a = a**2
>
> Float values: x*x = (a+e)(a+e)
>                    = a**2 + 2*a*e + e**2
>
> So the error term has increased from e to (2*a*e+e**2). It is usual to
> assume that e**2 is small enough that it underflows to zero, so we have the
> error term e increasing to 2*a*e as a fairly simple estimate of the new
> error.

And the relative error, which is what is often important, increases from 
e/a to 2e/a.

-- 
Terry Jan Reedy

Back to comp.lang.python | Previous | NextPrevious 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