Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
08/15/02 13:57
Read: times


 
#27279 - RE: moving average
Rounding should be used on any integer division.
Otherwise e.g. on 15 values of 10 and a single value of 9 the result was still 9 and you have added an error of almost 1 unit.



Ahhh. OK I see now. However, this:

#define div_rnd(x,y)    ((x + (x >> 1)) / y)


does not round before the division. What you meant was:

#define div_rnd(x,y)    ((x + (y >> 1)) / y)


Jon

List of 12 messages in thread
TopicAuthorDate
moving average            01/01/70 00:00      
RE: moving average            01/01/70 00:00      
RE: moving average            01/01/70 00:00      
RE: moving average            01/01/70 00:00      
RE: moving average            01/01/70 00:00      
RE: Steve            01/01/70 00:00      
RE: moving average            01/01/70 00:00      
RE: moving average            01/01/70 00:00      
RE: Peter.            01/01/70 00:00      
RE: moving average            01/01/70 00:00      
RE: moving average            01/01/70 00:00      
RE: moving average            01/01/70 00:00      

Back to Subject List