ArcCos(x)= Π √((1-x)/(4+x)).
The search for better and better approximations led Indian mathematicians to independently develop branches of differential and integral calculus.This tradition came to its own as Madhava school of mathematics from Kerala. https://en.wikipedia.org/wiki/Kerala_school_of_astronomy_and...
Note the approximation is for 0 < x < 1. For the range [-1, 0] Bhaskara used symmetry.
If I remember correctly, Aryabhatta had derived a rational approximation about a hundred years before this.
Let α represent a roll rotation, and β a pitch rotation.
Let R(α) be:
( cos α sin α 0)
(-sin α cos α 0)
( 0 0 1)
Let R(β) be: (1 0 0 )
(0 cos β -sin β)
(0 sin β cos β)
Combine them: R(β).R(α) = ( cos α sin α 0 )
((-sin α*cos β) (cos α*cos β) -sin β)
((-sin α*sin β) (cos α*sin β) cos β)
But! For small α and β, just approximate: ( 1 α 0)
(-α 1 -β)
( 0 β 1)
So now: x' = x + αy
y' = y - αx - βz
z' = z + βy
[1]https://news.ycombinator.com/item?id=47348192 constexpr double a0 = 1.5707288;That might explain why the original Cg (a GPU programming language) code did not use Estrin's, since at least the code in the post does add 1 extra op (squaring `abs_x`).
(AMD GPUs used to use VLIW (very long instruction word) which is "static" ILP).
That’s quite subjective. I happen to find trigonometry to be elegant and true.
I also agree that trigonometric functions lack efficiency in software.