In this post, Austin Z. Henley explores how to implement cosine in C, using several different approaches and optimizations. He benchmarks each implementation for both accuracy and runtime, with the goal of finding a method that is simple enough for him to understand, accurate enough that no one will notice the error, and fast enough for video game applications. The post covers a range of methods, including Taylor series, range reduction, lookup tables, and running products. The most accurate implementations come at a cost to runtime performance, but Henley finds a balance between accuracy and speed that is suitable for most applications.
https://austinhenley.com/blog/cosine.html