
Main algorithm: The Taylor series expansion of `asin(x)` is: ```math \begin{align*} asin(x) &= x + x^3 / 6 + 3x^5 / 40 + ... \\ &= x \cdot P(x^2) \\ &= x \cdot P(u) &\text{, where } u = x^2. \end{align*} ``` For the fast path, we perform range reduction mod 1/64 and use degree-7 (minimax + Taylor) polynomials to approximate `P(x^2)`. When `|x| >= 0.5`, we use the transformation: ```math u = \frac{1 + x}{2} ``` and apply half-angle formula to reduce `asin(x)` to: ```math \begin{align*} asin(x) &= sign(x) \cdot \left( \frac{\pi}{2} - 2 \cdot asin(\sqrt{u}) \right) \\ &= sign(x) \cdot \left( \frac{\pi}{2} - 2 \cdot \sqrt{u} \cdot P(u) \right). \end{align*} ``` Since `0.5 <= |x| <= 1`, `|u| <= 0.5`. So we can reuse the polynomial evaluation of `P(u)` when `|x| < 0.5`. For the accurate path, we redo the computations in 128-bit precision with degree-15 (minimax + Taylor) polynomials to approximate `P(u)`.
LLVM libc ========= This directory and its subdirectories contain source code for llvm-libc, a retargetable implementation of the C standard library. LLVM is open source software. You may freely distribute it under the terms of the license agreement found in LICENSE.txt.