Quote:
Originally Posted by BigJ
An easy way to stay away from the floating-point math is to do the calculations yourself, round to integers, and make a lookup table. There are way to accomplish these ideas in code though, through using bigger numbers to save precision while making calculations.
|
The disadvantage of a look-up table is that it is extremely difficult to change if the function doesn't work well. Imagine having to change 256 array entries! You can use the cubic code that Eagle gives above or your own quadratic code (which our team uses), while still staying away from floating-point math.
As long as you put all your division
at the end of the line, everything will be integer operations and shouldn't take much longer than a LUT.