Average Error: 0.0 → 0.0
Time: 15.2s
Precision: 64
\[2 \cdot \tan^{-1} \left(\sqrt{\frac{1 - x}{1 + x}}\right)\]
\[2 \cdot \tan^{-1} \left(\frac{\sqrt{1 \cdot 1 - x \cdot x}}{1 + x}\right)\]
2 \cdot \tan^{-1} \left(\sqrt{\frac{1 - x}{1 + x}}\right)
2 \cdot \tan^{-1} \left(\frac{\sqrt{1 \cdot 1 - x \cdot x}}{1 + x}\right)
double f(double x) {
        double r22695 = 2.0;
        double r22696 = 1.0;
        double r22697 = x;
        double r22698 = r22696 - r22697;
        double r22699 = r22696 + r22697;
        double r22700 = r22698 / r22699;
        double r22701 = sqrt(r22700);
        double r22702 = atan(r22701);
        double r22703 = r22695 * r22702;
        return r22703;
}

double f(double x) {
        double r22704 = 2.0;
        double r22705 = 1.0;
        double r22706 = r22705 * r22705;
        double r22707 = x;
        double r22708 = r22707 * r22707;
        double r22709 = r22706 - r22708;
        double r22710 = sqrt(r22709);
        double r22711 = r22705 + r22707;
        double r22712 = r22710 / r22711;
        double r22713 = atan(r22712);
        double r22714 = r22704 * r22713;
        return r22714;
}

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. Simplified0.0

    \[\leadsto \color{blue}{\tan^{-1} \left(\sqrt{\frac{1 - x}{1 + x}}\right) \cdot 2}\]
  3. Using strategy rm
  4. Applied sqrt-div0.0

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

    \[\leadsto \tan^{-1} \left(\frac{\sqrt{1 - x}}{\color{blue}{\sqrt{x + 1}}}\right) \cdot 2\]
  6. Using strategy rm
  7. Applied flip--0.0

    \[\leadsto \tan^{-1} \left(\frac{\sqrt{\color{blue}{\frac{1 \cdot 1 - x \cdot x}{1 + x}}}}{\sqrt{x + 1}}\right) \cdot 2\]
  8. Applied sqrt-div0.0

    \[\leadsto \tan^{-1} \left(\frac{\color{blue}{\frac{\sqrt{1 \cdot 1 - x \cdot x}}{\sqrt{1 + x}}}}{\sqrt{x + 1}}\right) \cdot 2\]
  9. Applied associate-/l/0.0

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

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

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

Reproduce

herbie shell --seed 2019194 +o rules:numerics
(FPCore (x)
  :name "arccos"
  (* 2.0 (atan (sqrt (/ (- 1.0 x) (+ 1.0 x))))))