Regarding using the Taylor series: "The problems lie in the approximation error. If you graph the absolute error of this function you find that it is very accurate for small angles around the origin of the Taylor expansion but the error increases almost exponentially away from x=0. Truncating the series later will
decrease the error but is not only is more costly and opens you to more danger of numerical error, but each additional term is another load/multiply-accumulate in your program. We need good accuracy across the whole range and we need it using as few terms as possible."
...
Minimax Polynomials
"The method used to find these polynomial approximations is called the Remez Exchange Algorithm."
Given title, slightly disappointed that TFA did not explain that they used Nix to bootstrap a verifiably optimal, hardware "magic-number-based" math library using Remez
I would have though https://en.wikipedia.org/wiki/CORDIC was the way to go
Related, fun link:
RNG and Cosine in Nix
https://unnamed.website/posts/rng-cosine-nix/
The perfect tool to use to debug:
https://web.mit.edu/jemorris/humor/500-miles
Here's a deep cut https://web.archive.org/web/20070128050622/https://www.resea...
Regarding using the Taylor series: "The problems lie in the approximation error. If you graph the absolute error of this function you find that it is very accurate for small angles around the origin of the Taylor expansion but the error increases almost exponentially away from x=0. Truncating the series later will decrease the error but is not only is more costly and opens you to more danger of numerical error, but each additional term is another load/multiply-accumulate in your program. We need good accuracy across the whole range and we need it using as few terms as possible."
...
Minimax Polynomials
"The method used to find these polynomial approximations is called the Remez Exchange Algorithm."
"
Given title, slightly disappointed that TFA did not explain that they used Nix to bootstrap a verifiably optimal, hardware "magic-number-based" math library using Remez
(stdlib cosf cosl etc would be example outputs)
That is why OP should be using Guix?
You get a full-blown programming language for free ;)