Just to point out as well that you can get extremely high accuracy with very little
memory usage by using the formula:
sine (x + d) = sin(x) cos(d) + cos(x) cos(d);
cosine (x + d) = cos(x) cos(d) - sin(x) sin(d)
You then have one small table for coarse angles (x) and one table for fractions of an
angle (d).
This method also has the sometimes desirable property that it is infinitely accurate
in VALUE (without iterations) even though it is
not fully accurate in ANGLE (which often is the value you are supplying and doesn'
tneed to be as specific.
If you iterate once with a third table of REALLY small values you can easily obtain
full precision on the angle as well. sin(x + d +
e)
OR -another way if you need the angle to be exact you can get yourself almost there
with the above formula and then use a standard
series for sin (d) and cos(d), which will converge quickly because d will be so small:
sin e ~ e
cos e ~ 1 + e2/2
Which gives sine/cosine to an accuracy of e3, so if e < 1/256, you get full float
precision.
Again, once you pick the accuracy you desire in angle and answer, there's an efficient
solution.
Now if only logs and exponentials could be this easy!
Cheers!
- Jeff
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/