Hacker News new | past | comments | ask | show | jobs | submit login

Most real math libraries will do this with only a quarter of the period, accounting for both sine and cosine in the same numerical approximation. You can then do range reduction into the region [0, pi/2) and run your approximation, flipping the X or Y axis as appropriate for either sine or cosine. This can be done branchlessly and in a SIMD-friendly way, and is far better than using a higher-order approximation to cover a larger region.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: