Thomas wrote: > A Taylor Series is definitely the way to go if you are > rolling your own.
Not if you want a good sine function! You need to consider errors and convergence. http://en.wikipedia.org/wiki/Generating_trigonometric_tables BTW, it's only necessary to compute sin(x) for x in [0, pi/2] because other values of x can be shifted into this interval. And if you're using a series method, check the conditions for convergence. Cosines can be calculated from sines as they're basically the same function but shifted. All computed sine functions are approximations. So it's a question of how much error you can tolerate, and how it's distributed. For example, you may be concerned that sin(0) == 0 exactly and sin(pi/2) == 1 exactly. A Taylor series will guarantee the first but not the second. Have a look at the CORDIC algorithm: http://en.wikipedia.org/wiki/CORDIC C code here: http://www.dcs.gla.ac.uk/~jhw/cordic/ David
