Average Error: 0.0 → 0.0
Time: 11.2s
Precision: 64
\[2 \cdot \tan^{-1} \left(\sqrt{\frac{1 - x}{1 + x}}\right)\]
\[2 \cdot \tan^{-1} \left(\sqrt{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1 - x}{1 + x}\right)\right)}\right)\]
2 \cdot \tan^{-1} \left(\sqrt{\frac{1 - x}{1 + x}}\right)
2 \cdot \tan^{-1} \left(\sqrt{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1 - x}{1 + x}\right)\right)}\right)
double f(double x) {
        double r26713 = 2.0;
        double r26714 = 1.0;
        double r26715 = x;
        double r26716 = r26714 - r26715;
        double r26717 = r26714 + r26715;
        double r26718 = r26716 / r26717;
        double r26719 = sqrt(r26718);
        double r26720 = atan(r26719);
        double r26721 = r26713 * r26720;
        return r26721;
}

double f(double x) {
        double r26722 = 2.0;
        double r26723 = 1.0;
        double r26724 = x;
        double r26725 = r26723 - r26724;
        double r26726 = r26723 + r26724;
        double r26727 = r26725 / r26726;
        double r26728 = log1p(r26727);
        double r26729 = expm1(r26728);
        double r26730 = sqrt(r26729);
        double r26731 = atan(r26730);
        double r26732 = r26722 * r26731;
        return r26732;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 0.0

    \[2 \cdot \tan^{-1} \left(\sqrt{\frac{1 - x}{1 + x}}\right)\]
  2. Using strategy rm
  3. Applied expm1-log1p-u0.0

    \[\leadsto 2 \cdot \tan^{-1} \left(\sqrt{\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1 - x}{1 + x}\right)\right)}}\right)\]
  4. Final simplification0.0

    \[\leadsto 2 \cdot \tan^{-1} \left(\sqrt{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1 - x}{1 + x}\right)\right)}\right)\]

Reproduce

herbie shell --seed 2019347 +o rules:numerics
(FPCore (x)
  :name "arccos"
  :precision binary64
  (* 2 (atan (sqrt (/ (- 1 x) (+ 1 x))))))