From: Rune Allnor <>
Newsgroups: comp.soft-sys.matlab
Subject: Re: adding order matters for accuracy ?
Date: Thu, 17 Sep 2009 00:32:12 -0700 (PDT)
Lines: 32
Message-ID: <>
References: <h8mqh5$pgb$>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
X-Trace: 1253172732 15427 (17 Sep 2009 07:32:12 GMT)
NNTP-Posting-Date: Thu, 17 Sep 2009 07:32:12 +0000 (UTC)
Injection-Info:; posting-host=; 
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; 
	Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; 
	.NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET CLR 1.1.4322),gzip(gfe),gzip(gfe)
Xref: comp.soft-sys.matlab:570999

On 15 Sep, 03:27, "Ana-Maria Cuculescu" <> wrote:
> Does the order in which we add numbers affect the accuracy of the result in Matlab?
> For example, if I add
> 1/1 + 1/2 + ... + 1/100000 in this order
> and, then, if I add
> 1/100000 + 1/2 + ... + 1/1 in this order
> will the adding order generate errors from the point of view of accuracy?

Well, it is not the order the numbers are added
that generates the error. As you know from working
with pen and paper, the order the numbers are added
does not influence the result, assuming the numbers
are exact. The error is in the numbers themselves
because they are represented inside computer on
inexact floating point formats.

The order the numbers are added influence how
the already present error is magnified throughout
the computation.

Knowing how to handle such issues is an art,
and is among the details that separate brilliant
numeric programmers from mere good ones. You will
find these kinds of questions discussed in texts
on numerical methods.