Hacker News new | ask | show | jobs
by jacobolus 3370 days ago
It’s probably a generally better idea to use a polynomial approximation if you have a floating point unit; a degree 8 polynomial for sin(x) on the range [0, π/2] gets you to just about the limits of single precision floating point. If you only need about 4 digits of precision, you can use a degree 5 polynomial.
2 comments

Couldn't you do better by only using the range [0, π/4] and noting that sin(x) = cos(x - π/2)?
Sure, then you can get away with an even smaller degree polynomial.
FWIW, Applesoft for the 6502 uses a 5th order poly.