Re: Two implementations of simple math equation yield different
by Avi <avner-moshkovitz@[EMAIL PROTECTED]
>
May 13, 2008 at 10:02 AM
One way to identify and ignore small differences is to set a small
threshold, say:
double epsilon =3D 1E-6
and compare the difference against the threshold as follows:
if (abs(diff) < epsilon)
{
// difference is considered as noise
}
{
// difference is significant
}
I=92m looking for a predefined threshold that the differences can be
measured against.
For example, the difference between 1 and the smallest value greater
than 1 that is representable for the double data type is 2.22045e-16.
I get it using: numeric_limits<double>::epsilon()
The differences that I=92m seeing between the two implementations (in
the order of 1-E15) are bigger than the
numeric_limits<double>::epsilon() value (2.22045e-16).
I understand that the ac***ulated round off errors can be bigger than
the numeric_limits<double>::epsilon() value.
Is there a systematic threshold that can be used to define when the
differences are noise and when they are significant?
Or should I just pick a number which is small enough in my mind (say
epsilon =3D 1 E-6)?
Thanks,
Avi