llvm-project
78cc822a - [libc][math] Implement double precision acos correctly rounded for all rounding modes. (#138308)

Commit
182 days ago
[libc][math] Implement double precision acos correctly rounded for all rounding modes. (#138308) We reduce computation of `acos` to `asin` as follow: When `|x| < 0.5`: ```math acos(x) = \frac{\pi}{2} - asin(x). ``` For `0.5 <= |x| < 1`, let ```math u = \frac{1 - \left| x \right|}{2}, ``` then ```math acos(x) = \begin{cases} 2 \cdot asin \left( \sqrt{u} \right) &, 0.5 \leq x < 1 \\ \pi - 2 \cdot asin \left( \sqrt{u} \right) &, -1 < x \leq 0.5 \end{cases} ```
Author
Parents
Loading