# [Numpy-discussion] Different results from repeated calculation, part 2

Andrew Dalke dalke@dalkescientific....
Fri Aug 15 21:18:57 CDT 2008

```On Aug 16, 2008, at 3:02 AM, Xavier Gnata wrote:
> abs(a-b)<epsilon is the correct way to test that a and b are "equal".

But 1) the value of epsilon is algorithm dependent, 2) it may be that

-epsilon1 < a-b < epsilon2

where the epsilons are not the same value, 3) the more valid
test may be "<=" instead of "<" as when the maximum permissible
difference is 0.5 ulp, and 4) the more important test (as mentioned
in the Monniaux paper you referenced) may be the relative error
and not the absolute error, which is how you wrote it.

So saying that this is the correct way isn't that helpful.  It
requires proper numeric analysis and that isn't always available.

An advantage to checking if a==b is that if they are in fact
equal then there's no need to do any analysis.  Whereas if you
choose some epsilon (or epsilon-relative) then how do you
pick that number?

Andrew
dalke@dalkescientific.com

```