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 8 of 10 Topic 45893 of 47035
Post > Topic >>

Re: Two implementations of simple math equation yield different

by Victor Bazarov <v.Abazarov@[EMAIL PROTECTED] > May 13, 2008 at 01:25 PM

Avi wrote:
> One way to identify and ignore small differences is to set a small
> threshold, say:
> double epsilon = 1E-6
> and compare the difference against the threshold as follows:
> 
> if (abs(diff) < epsilon)
> {
> // difference is considered as noise
> }
> {
> // difference is significant
> }
> 
> [..]
> 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 = 1 E-6)?

It depends on your problem domain.  Some compare absolute differences
(like you're suggesting here) and are happy.  Some make the diff value
relative to the range (by dividing the diff by the larger of the two
values).  If all the numbers are from the same range you're going to
be fine if you just pick the value that "fits" your range.  The value
of the numeric epsilon only relates to the range from 0 to 1, IIRC.

V
-- 
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
 




 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 Sat Jul 26 3:45:26 CDT 2008.