# [time-nuts] PLL Math Question

Bob Stewart bob at evoria.net
Thu Mar 13 15:10:27 EDT 2014

```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.
>
>
```