How not to calculate cosine
Read OriginalThis article discusses the pitfalls of using power series to compute trigonometric functions, specifically cosine, for large arguments. The author, who has hardware implementation experience, argues that professors often oversimplify by suggesting power series, but these fail for values far from the series center. Using cos(200) as an example, the article shows that summing 287 terms leads to catastrophic cancellation and overflow issues, resulting in a wildly incorrect value. It then explains the need for range reduction, such as reducing the angle modulo 2π, and notes precision loss in naive reduction. The article is technical, aimed at programmers and engineers, and provides insights into numerical computing best practices.
Comments
No comments yet
Be the first to share your thoughts!
Browser Extension
Get instant access to AllDevBlogs from your browser