Average Error: 0.0 → 0.0
Time: 24.9s
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 r394688 = 2.0;
        double r394689 = 1.0;
        double r394690 = x;
        double r394691 = r394689 - r394690;
        double r394692 = r394689 + r394690;
        double r394693 = r394691 / r394692;
        double r394694 = sqrt(r394693);
        double r394695 = atan(r394694);
        double r394696 = r394688 * r394695;
        return r394696;
}

double f(double x) {
        double r394697 = 1.0;
        double r394698 = x;
        double r394699 = r394697 - r394698;
        double r394700 = r394697 + r394698;
        double r394701 = r394699 / r394700;
        double r394702 = log1p(r394701);
        double r394703 = expm1(r394702);
        double r394704 = sqrt(r394703);
        double r394705 = atan(r394704);
        double r394706 = 2.0;
        double r394707 = r394705 * r394706;
        return r394707;
}

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 2019151 +o rules:numerics
(FPCore (x)
  :name "arccos"
  (* 2 (atan (sqrt (/ (- 1 x) (+ 1 x))))))