Average Error: 0.0 → 0.0
Time: 10.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 r266039 = 2.0;
        double r266040 = 1.0;
        double r266041 = x;
        double r266042 = r266040 - r266041;
        double r266043 = r266040 + r266041;
        double r266044 = r266042 / r266043;
        double r266045 = sqrt(r266044);
        double r266046 = atan(r266045);
        double r266047 = r266039 * r266046;
        return r266047;
}

double f(double x) {
        double r266048 = 1.0;
        double r266049 = x;
        double r266050 = r266048 - r266049;
        double r266051 = r266048 + r266049;
        double r266052 = r266050 / r266051;
        double r266053 = log1p(r266052);
        double r266054 = expm1(r266053);
        double r266055 = sqrt(r266054);
        double r266056 = atan(r266055);
        double r266057 = 2.0;
        double r266058 = r266056 * r266057;
        return r266058;
}

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