I've been studying an approach to implementing a lookup table (LUT) to implement a sine function. The two msbs of the phase define the quadrant. I have decided that an 8 bit address for a single quadrant is sufficient with an 18 bit output. Another 11 bits of phase will give me sufficient resolution to interpolate the sin() to 18 bits.
If you assume a straight line between the two endpoints the midpoint of each interpolated segment will have an error of ((Sin(high)-sin(low))/2)-sin(mid)
Without considering rounding, this reaches a maximum at the last segment before the 90 degree point. I calculate about 4-5 ppm which is about the same as the quantization of an 18 bit number.
There are two issues I have not come across regarding these LUTs. One is adding a bias to the index before converting to the sin() value for the table. Some would say the index 0 represents the phase 0 and the index 2^n represents 90 degrees. But this is 2^n+1 points which makes a LUT inefficient, especially in hardware. If a bias of half the lsb is added to the index before converting to a sin() value the value 0 to2^n-1 becomes symmetrical with 2^n to 2^(n+1)-1 fitting a binary sized table properly. I assume this is commonly done and I just can't find a mention of it.
The other issue is how to calculate the values for the table to give the best advantage to the linear interpolation. Rather than using the exact match to the end points stored in the table, an adjustment could be done to minimize the deviation over each interpolated segment. Without this, the errors are always in the same direction. With an adjustment the errors become bipolar and so will reduce the magnitude by half (approx). Is this commonly done? It will require a bit of computation to get these values, but even a rough approximation should improve the max error by a factor of two to around 2-3 ppm.
Now if I can squeeze another 16 dB of SINAD out of my CODEC to take advantage of this resolution! lol
One thing I learned while doing this is that near 0 degrees the sin() function is linear (we all knew that, right?) but near 90 degrees, the sin() function is essentially quadratic. Who would have thunk it?