Dennis, I just realized that I could do the math in sixteenths. So, for 7/16ths multiply by 7 before shifting(i.e. dividing) and rounding. That would probably give enough granularity. I'll have to think about it. It does open new doors.
thanks, Bob >________________________________ > From: Dennis Ferguson <dennis.c.fergu...@gmail.com> >To: Discussion of precise time and frequency measurement <time-nuts@febo.com> >Cc: Hal Murray <hmur...@megapathdsl.net> >Sent: Thursday, March 13, 2014 1:58 PM >Subject: Re: [time-nuts] PLL Math Question > > >Note that you can't do fixed-point computations exactly the same way >you would do it in floating point, you often need to rearrange the equations >a bit. You can usually find a rearrangement which provides equivalent >results, however. Let's define an extra variable, x_sum, where > > x_avg = x_sum * a_avg; > >The equation above can then be rewritten in terms of x_sum, i.e. > > x_sum = x_sum * (1 - a_avg) + x; > >With an a_avg of 1/8 you'll instead be multiplying x_sum by 7, shifting >it right 3 bits (you might want to round before the shift) and adding x. >The new value of x_avg can be computed from the new value of x_sum with a >shift (you might want to round that too), or you could pretend that x_sum >is a fixed-point number with the decimal point 3 bits from the right. >In either case x_sum carries enough bits that you don't lose precision. > > _______________________________________________ time-nuts mailing list -- time-nuts@febo.com To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts and follow the instructions there.