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


Groups > comp.lang.python > #12841

Re: Floating point multiplication in python

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!news.visyn.net!visyn.net!news-2.dfn.de!news.dfn.de!news.uni-stuttgart.de!news.belwue.de!newsfeed.arcor.de!newsspool3.arcor-online.net!news.arcor.de.POSTED!not-for-mail
Content-Type text/plain; charset="UTF-8"
Message-ID <2204592.egLE2XKegd@PointedEars.de> (permalink)
From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Reply-To Thomas 'PointedEars' Lahn <usenet@PointedEars.de>
Organization PointedEars Software (PES)
Date Tue, 06 Sep 2011 18:07:42 +0200
User-Agent KNode/4.4.11
Content-Transfer-Encoding 8Bit
Subject Re: Floating point multiplication in python
Newsgroups comp.lang.python
References <mailman.790.1315289581.27778.python-list@python.org> <j44rre$e4c$1@r03.glglgl.eu>
Followup-To comp.lang.python
MIME-Version 1.0
Lines 40
NNTP-Posting-Date 06 Sep 2011 18:07:44 CEST
NNTP-Posting-Host 974ecb64.newsspool1.arcor-online.net
X-Trace DXC=C4UHTNAOne4LNKYb?b>076ic==]BZ:af>4Fo<]lROoR1<`=YMgDjhg2D^`i3[Q<Q2>DZm8W4\YJN<UFDj8T]K0?3DmniOZG;K0;_B[Qd01neK0
X-Complaints-To usenet-abuse@arcor.de
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:12841

Followups directed to: comp.lang.python

Show key headers only | View raw


Thomas Rachel wrote:

> Now if you multiply two values with an error, the error also propagates
> into the result - PLUs the result can have its own error source - in the
> same order of magnitude.
> 
> (a+e) * (a+e) = a*a + 2*a*e + e*e. So your new error term is 2*a*e + e*e
> or (2*a + e) * e.

Your explanation about floating-point precision, which I already knew about 
but have only scanned here – so it might be flawed as well –, 
notwithstanding, it is not clear to me at all what you are trying to prove 
there.

Computers (well, perhaps outside of mathematical software) do NOT compute an 
equation as humans would do, so the binomial theorem does NOT apply.  In an 
algorithm of the real implementation,

  (a + e) * (a + e)

would be computed as follows:

  b := a + e
  c := b * b
    or
  c := b + … + b

[add the value of `b' to the value of `b' (b−1) times, since binary logic 
does not support multiplication]

IOW, the error does propagate into the result indeed, but not as you 
described.  Indeed, thanks to rounding on assignment and multiplication
(i. e., setting register values or IEEE-754 floating-point mantissa and 
exponent), the error will be different, probably greater than you compute 
here.

-- 
PointedEars

Bitte keine Kopien per E-Mail. / Please do not Cc: me.

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