An adventure in trying to optimize math.Atan2 with Go assembly
Although this post is interesting, the best way to optimize trig functions is generally via rational approximations[1] if you can live with the error (and the clamping). I remember finding a rational function to approximate a tanh-like soft clipper via a Padé approximator on (-1, 1) a few years ago[2]. See an equivalent rational approximation for atan2 here[3].<p>[1] <a href="http://www.embedded.com/design/other/4216719/Performing-efficient-arctangent-approximation" rel="nofollow">http://www.embedded.com/design/other/4216719/Performing-effi...</a><p>[2] <a href="https://stackoverflow.com/questions/6118028/fast-hyperbolic-tangent-approximation-in-javascript/6118100#6118100" rel="nofollow">https://stackoverflow.com/questions/6118028/fast-hyperbolic-...</a><p>[3] <a href="https://www.dsprelated.com/showarticle/1052.php" rel="nofollow">https://www.dsprelated.com/showarticle/1052.php</a>