[time-nuts] PLL Math Question
Chris Albertson
albertson.chris at gmail.com
Thu Mar 13 18:42:23 EDT 2014
You don't really shift so much as just change the way you think about it.
The way to think about it is not that you have "16th" but that you have the
"binary point" force places over. It works just like a decimal point. If
you multiply two numbers each that has four places to the right of the
point you have now eight places to the right. You can shift it or not. If
you use 64 bit "longs" you sand up not having to shift so much because
those can cary up to about 32 binary places.
On Thu, Mar 13, 2014 at 12:10 PM, Bob Stewart <bob at evoria.net> wrote:
> 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.ferguson at gmail.com>
> >To: Discussion of precise time and frequency measurement <
> time-nuts at febo.com>
> >Cc: Hal Murray <hmurray at 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 at febo.com
> To unsubscribe, go to
> https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
> and follow the instructions there.
>
--
Chris Albertson
Redondo Beach, California
More information about the time-nuts
mailing list