Average Error: 0.0 → 0.0
Time: 4.5s
Precision: 64
\[2 \cdot \tan^{-1} \left(\sqrt{\frac{1 - x}{1 + x}}\right)\]
\[2 \cdot \tan^{-1} \left(\sqrt{\frac{1}{\sqrt{1 + x}} \cdot \frac{1 - x}{\sqrt{1 + x}}}\right)\]
2 \cdot \tan^{-1} \left(\sqrt{\frac{1 - x}{1 + x}}\right)
2 \cdot \tan^{-1} \left(\sqrt{\frac{1}{\sqrt{1 + x}} \cdot \frac{1 - x}{\sqrt{1 + x}}}\right)
double f(double x) {
        double r16699 = 2.0;
        double r16700 = 1.0;
        double r16701 = x;
        double r16702 = r16700 - r16701;
        double r16703 = r16700 + r16701;
        double r16704 = r16702 / r16703;
        double r16705 = sqrt(r16704);
        double r16706 = atan(r16705);
        double r16707 = r16699 * r16706;
        return r16707;
}

double f(double x) {
        double r16708 = 2.0;
        double r16709 = 1.0;
        double r16710 = 1.0;
        double r16711 = x;
        double r16712 = r16710 + r16711;
        double r16713 = sqrt(r16712);
        double r16714 = r16709 / r16713;
        double r16715 = r16710 - r16711;
        double r16716 = r16715 / r16713;
        double r16717 = r16714 * r16716;
        double r16718 = sqrt(r16717);
        double r16719 = atan(r16718);
        double r16720 = r16708 * r16719;
        return r16720;
}

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-sqr-sqrt0.0

    \[\leadsto 2 \cdot \tan^{-1} \left(\sqrt{\frac{1 - x}{\color{blue}{\sqrt{1 + x} \cdot \sqrt{1 + x}}}}\right)\]
  4. Applied *-un-lft-identity0.0

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

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

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

Reproduce

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