Average Error: 0.0 → 0.0
Time: 1.5m
Precision: 64
\[2 \cdot \tan^{-1} \left(\sqrt{\frac{1 - x}{1 + x}}\right)\]
\[\tan^{-1} \left(\sqrt{e^{\log \left(1 - x\right) - \mathsf{log1p}\left(x\right)}}\right) \cdot 2\]
2 \cdot \tan^{-1} \left(\sqrt{\frac{1 - x}{1 + x}}\right)
\tan^{-1} \left(\sqrt{e^{\log \left(1 - x\right) - \mathsf{log1p}\left(x\right)}}\right) \cdot 2
double f(double x) {
        double r3562209 = 2.0;
        double r3562210 = 1.0;
        double r3562211 = x;
        double r3562212 = r3562210 - r3562211;
        double r3562213 = r3562210 + r3562211;
        double r3562214 = r3562212 / r3562213;
        double r3562215 = sqrt(r3562214);
        double r3562216 = atan(r3562215);
        double r3562217 = r3562209 * r3562216;
        return r3562217;
}

double f(double x) {
        double r3562218 = 1.0;
        double r3562219 = x;
        double r3562220 = r3562218 - r3562219;
        double r3562221 = log(r3562220);
        double r3562222 = log1p(r3562219);
        double r3562223 = r3562221 - r3562222;
        double r3562224 = exp(r3562223);
        double r3562225 = sqrt(r3562224);
        double r3562226 = atan(r3562225);
        double r3562227 = 2.0;
        double r3562228 = r3562226 * r3562227;
        return r3562228;
}

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 add-exp-log0.0

    \[\leadsto 2 \cdot \tan^{-1} \left(\sqrt{\frac{1 - x}{\color{blue}{e^{\log \left(1 + x\right)}}}}\right)\]
  4. Applied add-exp-log0.0

    \[\leadsto 2 \cdot \tan^{-1} \left(\sqrt{\frac{\color{blue}{e^{\log \left(1 - x\right)}}}{e^{\log \left(1 + x\right)}}}\right)\]
  5. Applied div-exp0.0

    \[\leadsto 2 \cdot \tan^{-1} \left(\sqrt{\color{blue}{e^{\log \left(1 - x\right) - \log \left(1 + x\right)}}}\right)\]
  6. Simplified0.0

    \[\leadsto 2 \cdot \tan^{-1} \left(\sqrt{e^{\color{blue}{\log \left(1 - x\right) - \mathsf{log1p}\left(x\right)}}}\right)\]
  7. Final simplification0.0

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

Reproduce

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