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> From: Thomas 'PointedEars' Lahn Reply-To: Thomas 'PointedEars' Lahn 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: 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[QDZm8W4\YJN 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.