Skip to main content
3 of 7
added an explanation
Arnauld
  • 197.7k
  • 20
  • 179
  • 650

JavaScript (ES7), 98 bytes

Probably not the golfiest formulas, especially for edge cases.

Returns [atan(x), asin(x), acos(x)].

x=>[(p=1.571,g=x=>v=1/x?x/(h=k=>2*++k-1+(k>>9?0:k*k*x*x/h(k)))``:p)(x),p-2*g((1-x*x)**.5/++x),2*v]

Try it online!

Formulas

The arctangent is approximated with the continued fractions:

$$\arctan(x)=\dfrac{x}{1+\dfrac{(1x)^2}{3+\dfrac{(2x)^2}{5+\dfrac{(3x)^2}{7+\ddots}}}}$$

We then use:

$$\arccos(x)=2\arctan\left(\frac{\sqrt{1-x^2}}{1+x}\right)$$

and:

$$\arcsin(x)=\frac{\pi}{2}-\arccos(x)$$

Arnauld
  • 197.7k
  • 20
  • 179
  • 650