Olin Lathrop wrote: > Sean Breheny wrote: > =20 >> For example, if we have a filter factor of 16, with Olin's example, >> and using integer math, we have: >> >> FILT<--FILT + (NEW-FILT)/16 >> >> If the absolute value of the difference NEW-FILT is less than 16, >> nothing ever happens. >> =20 > > Right. You generally want to use Log2 fraction bits to avoid this. > =20 Where are your fractional bits? In Filt? Are you doing floating point=20 math? If you are, converting to integer math without loss of resolution=20 IS a 'free lunch'. > However, the other version doesn't give you a free lunch. It looks like > TOTAL will float around the value times the same factor that you're divid= ing > by in the equation above. That just means you're adding the bits on the > left instead of the right. > =20 Yes, Total will float around that number. Do you mean adding bits on the right instead of the left? The=20 fractional bits in mine are on the right side of the equation. Am I=20 getting confused? > So you have to leave overflow bits on the left or add the same number of > fraction bits on the right. > > > ******************************************************************** > Embed Inc, Littleton Massachusetts, http://www.embedinc.com/products > (978) 742-9014. Gold level PIC consultants since 2000. > =20 Kerry, fresh off the turnip truck --=20 Internal Virus Database is out-of-date. Checked by AVG Anti-Virus. Version: 7.0.289 / Virus Database: 267.11.13 - Release Date: 10/6/05 --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .