Average Error: 0.0 → 0.0
Time: 25.4s
Precision: 64
\[2 \cdot \tan^{-1} \left(\sqrt{\frac{1 - x}{1 + x}}\right)\]
\[\tan^{-1} \left(\sqrt{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1 - x}{1 + x}\right)\right)}\right) \cdot 2\]
2 \cdot \tan^{-1} \left(\sqrt{\frac{1 - x}{1 + x}}\right)
\tan^{-1} \left(\sqrt{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1 - x}{1 + x}\right)\right)}\right) \cdot 2
double f(double x) {
        double r371654 = 2.0;
        double r371655 = 1.0;
        double r371656 = x;
        double r371657 = r371655 - r371656;
        double r371658 = r371655 + r371656;
        double r371659 = r371657 / r371658;
        double r371660 = sqrt(r371659);
        double r371661 = atan(r371660);
        double r371662 = r371654 * r371661;
        return r371662;
}

double f(double x) {
        double r371663 = 1.0;
        double r371664 = x;
        double r371665 = r371663 - r371664;
        double r371666 = r371663 + r371664;
        double r371667 = r371665 / r371666;
        double r371668 = log1p(r371667);
        double r371669 = expm1(r371668);
        double r371670 = sqrt(r371669);
        double r371671 = atan(r371670);
        double r371672 = 2.0;
        double r371673 = r371671 * r371672;
        return r371673;
}

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 \tan^{-1} \left(\sqrt{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1 - x}{1 + x}\right)\right)}\right) \cdot 2\]

Reproduce

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