Talk:Averages/Simple moving average

From Rosetta Code
Revision as of 14:51, 20 June 2009 by rosettacode>Kevin Reid (New page: ==Numerical soundness== The implementations which use or permit floats and keep a running sum which is added to and subtracted from, if given nontrivial numbers, will eventually have the ...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Numerical soundness

The implementations which use or permit floats and keep a running sum which is added to and subtracted from, if given nontrivial numbers, will eventually have the sum drift away from the actual value because floating-point arithmetic is nonassociative ((((a + b) + c) + d) - a is not necessarily equal to (((a - a) + b) + c) + d = (b + c) + d); should this be considered incorrect, or warned about? --Kevin Reid 14:51, 20 June 2009 (UTC)