Quote:
I had formed the impression that a sine table
with quadratic interpolation is generally faster
and less resource-intensive than CORDIC
(but I never really compared the two myself)
The tables I supply don't need any interpolation, since there are 65,536 entries of 16 bits each, meaning most tables are 128KB; so a 16-bit input number gives a 16-bit output that is as accurate as 16 bits allows. Tables can be made for any function, not just trig functions.
Quote:
There's also series expansion:
Sin(z) = z - (z^3/3!) + (z^5/5!) - (z^7/7!) ...
I think you need about four terms to get 16 bits
(actually more like 20 bits)
Four is enough if you tweak the coefficients to make up. The sin & cos routines I had written in Forth only use four terms, and I experimented with the coefficients and got it such that the answer is usually correct in all bits, and in the few times it's not correct, it was only one lsb high. It's possible I did not arrive at the best set of coefficients.
My tables were not calculated this way though. For those, I used an HP hand-held computer that does it in 15 decimal digits, and rounded to the nearest answer representable in 16 bits.