Average Error: 0.0 → 0.0
Time: 5.0s
Precision: 64
\[2 \cdot \tan^{-1} \left(\sqrt{\frac{1 - x}{1 + x}}\right)\]
\[2 \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(\tan^{-1} \left(\sqrt{\frac{1 - x}{1 + x}}\right)\right)\right)\]
2 \cdot \tan^{-1} \left(\sqrt{\frac{1 - x}{1 + x}}\right)
2 \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(\tan^{-1} \left(\sqrt{\frac{1 - x}{1 + x}}\right)\right)\right)
double f(double x) {
        double r13115 = 2.0;
        double r13116 = 1.0;
        double r13117 = x;
        double r13118 = r13116 - r13117;
        double r13119 = r13116 + r13117;
        double r13120 = r13118 / r13119;
        double r13121 = sqrt(r13120);
        double r13122 = atan(r13121);
        double r13123 = r13115 * r13122;
        return r13123;
}

double f(double x) {
        double r13124 = 2.0;
        double r13125 = 1.0;
        double r13126 = x;
        double r13127 = r13125 - r13126;
        double r13128 = r13125 + r13126;
        double r13129 = r13127 / r13128;
        double r13130 = sqrt(r13129);
        double r13131 = atan(r13130);
        double r13132 = expm1(r13131);
        double r13133 = log1p(r13132);
        double r13134 = r13124 * r13133;
        return r13134;
}

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 log1p-expm1-u0.0

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

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

Reproduce

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