From: "John D'Errico" <>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Subtracting sets of nearly equal fp numbers
Date: Fri, 16 Dec 2011 15:22:08 +0000 (UTC)
Organization: John D'Errico (1-3LEW5R)
Lines: 12
Message-ID: <jcfnn0$d3e$>
References: <jcfgck$geh$>
Reply-To: "John D'Errico" <>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: 1324048928 13422 (16 Dec 2011 15:22:08 GMT)
NNTP-Posting-Date: Fri, 16 Dec 2011 15:22:08 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 869215
Xref: comp.soft-sys.matlab:752542

"Richard " <> wrote in message <jcfgck$geh$>...
> If I have two sets of data that are very similar , and want to find the difference, is there a best practice for avoiding loss of significance.? I.e. add a constant to one set prior to subtraction and the subtracting the offset?

No. There is no magic trick to prevent a loss of significance
here. In fact, adding some constant to each number will only
increase the error at the end.

The "best practice" is just to subtract the numbers, and live
with the loss of precision!