Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #12841
| Message-ID | <2204592.egLE2XKegd@PointedEars.de> (permalink) |
|---|---|
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
| Organization | PointedEars Software (PES) |
| Date | 2011-09-06 18:07 +0200 |
| 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 |
Followups directed to: comp.lang.python
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 | Next — Previous in thread | Next in thread | Find similar | Unroll 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