[hpsdr] exact frequency determination
John Marvin
jm-hpsdr at themarvins.org
Thu Nov 21 10:24:12 PST 2013
Chris,
Are you referring to this part of my explanation:
> This can be reduced to:
>
> Frequency * 2^16 / 1875
>
> In order to preserve accuracy while doing integer math we shift everything to the left 25 bits, use a nearby integer constant for the multiply and then shift the result back 25 bits:
>
> (Frequency * 2^41 / 1875) >> 25
If so, I think the confusion might be that I did the left shift by
changing the 2^16 to 2^41. The two equations are equivalent, since the
second equation includes both a 25 bit left shift and a 25 bit right shift.
Regards,
John
AC0ZG
On 11/21/2013 3:58 AM, Chris Smith wrote:
> John
>
> Last time I looked in a C or C++ programming manual >> denoted a right shift - divide by 2^n. Unless the integer arithmetic is double length and you're trying to end up with all the bits in the LS half. But then the shift would have to be n-25 where n is the word length in bits. Or should that be 25-n … ? I can't be bothered to work it out. :-)
>
> Chris G4NUX
>
1385058252.0
More information about the Hpsdr
mailing list