← Back to team overview

kicad-developers team mailing list archive

Re: Trigonometric look up table.


On 09/19/2011 02:00 PM, Kerusey Karyu wrote:
> Dnia 2011-09-19, pon o godzinie 11:15 -0400, Wayne Stambaugh pisze:
>> Is there any logical reason to keep using the trigonometric look up tables in
>> trigo.cpp?  We currently have a mixed bag of using the look up tables and the
>> math sin() and cos() functions in various code paths.  If no one objects, I
>> think it's time to remove them from Kicad.
>> Wayne
> I'm not familiar with a KiCAD source, but I think the lookup tables
> should stay. Why? In some cases a lookup will be faster than math
> functions. I don't know, but while redrawing - an arc for example -
> these tables speed-up a lot the screen refreshing.
> Kerusey Karyu

Do you have approximate benchmarks?

I vaguely remember that on a modern day desktop machine, say Intel, that the sin()
function took only about 12 clock cycles nowadays.  This is because of the high end FPUs
in them.

I am not sure about this, and do not have time to research it.