Hey!

I'm working on writing libraries to do all sorts of things like IO and arithmetic. I've come across a problem though and am not sure what the best approach would be.

The problem is that I want to evaluate elementary functions, like sine, exp, etc. to high degree of precision while leaving a low memory footprint. I'm working with an Atmega328P so I have 32k program memory and 2k sram. So far I have implemented some basic functions for signed and unsigned integers of different sizes and also signed floats (IEEE-754). The question now is how to evaluate functions such that I get a precise^{1} signed float back quickly.

I would see how one can use a table in program memory to lookup certain values. However this costs way too much memory to get precision.

Another way would be to use a Taylor series for the given function. However this costs way too much time to be fast and isn't even that precise.

Maybe it is possible to use interpolation to save space when going with the table approach? I'd like to hear your guys' input on this.

_{1: by precise I mean it uses all 23 bits of the mantissa.}