Antti, Mauro, Thanks for your comments. On 15/12/14 7:00 pm, "Antti Palosaari" <crope@xxxxxx> wrote: >On 12/15/2014 03:13 PM, Mauro Carvalho Chehab wrote: >> Em Mon, 15 Dec 2014 14:49:17 +0530 >> Prashant Laddha <prladdha@xxxxxxxxx> escreveu: >> >>> Replaced Taylor series calculation for (co)sine with a >>> look up table (LUT) for sine values. >> >> Kernel has already a LUT for sin/cos at: >> include/linux/fixp-arith.h >> >> The best would be to either use it or improve its precision, if the one >>there >> is not good enough. Thanks. I had not looked at this file earlier. But now when I looked at this file I agree with Antti¹s comments below. > >I looked that one when made generator. It has poor precision and it uses >degrees not radians. > Also, it does not support calculation for phase values falling in middle of two entries of LUT. >But surely it is correct practice improve existing >than introduce new. I agree. Probably we can start looking into how to improve existing. I looked at dependancies. As of now functions in fixp-arith is used by two other files. Replacing current implementation in fixp-arith.h with high precision will not work as it is, because caller functions are using lesser precision. We probably need to discuss more on how to improve existing implementation. Some thoughts - 1. Going by the name fixp-arith.h, I feel, it should have larger scope than just (co)sine implementation. It can include divide as well. One could also consider option to keep all trignometric functions in another file 2. One could support APIs to provide output with different precisions, say 16, 32, 64 bits etc. Not sure how final implementation would be but one option would be to do internal computation with highest precision possible and then truncate the result to have desired precision based on the API called. Regards, Prashant 淸{.n+돴윯돪+%듚깁負w{.n+돴{깸g돬왲^nr⊆z곷h솳鈺&{z요z받쀺++zf"h닱~넮녬i곴묎z_溫j:+v돣)山m