Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C++ > Re: Two impleme...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 7 of 10 Topic 45893 of 47006
Post > Topic >>

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
 




 10 Posts in Topic:
Two implementations of simple math equation yield different resu
Avi <avner-moshkovitz@  2008-05-12 22:16:30 
Re: Two implementations of simple math equation yield different
Paavo Helde <nobody@[E  2008-05-13 00:34:44 
Re: Two implementations of simple math equation yield different
"Alf P. Steinbach&qu  2008-05-13 07:37:47 
Re: Two implementations of simple math equation yield different
James Kanze <james.kan  2008-05-13 02:42:18 
Re: Two implementations of simple math equation yield different
Greg Herlihy <greghe@[  2008-05-13 03:15:20 
Re: Two implementations of simple math equation yield different
Avi <avner-moshkovitz@  2008-05-13 10:00:55 
Re: Two implementations of simple math equation yield different
Avi <avner-moshkovitz@  2008-05-13 10:02:01 
Re: Two implementations of simple math equation yield different
Victor Bazarov <v.Abaz  2008-05-13 13:25:30 
Re: Two implementations of simple math equation yield different
Avi <avner-moshkovitz@  2008-05-13 10:52:29 
Re: Two implementations of simple math equation yield different
James Kanze <james.kan  2008-05-14 01:04:47 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Thu Jul 24 1:56:14 CDT 2008.