Average Error: 0.0 → 0.0
Time: 4.8s
Precision: 64
\[2 \cdot \tan^{-1} \left(\sqrt{\frac{1 - x}{1 + x}}\right)\]
\[2 \cdot \tan^{-1} \left(\sqrt{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1}{\sqrt{1 + x}} \cdot \frac{1 - x}{\sqrt{1 + x}}\right)\right)}\right)\]
2 \cdot \tan^{-1} \left(\sqrt{\frac{1 - x}{1 + x}}\right)
2 \cdot \tan^{-1} \left(\sqrt{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1}{\sqrt{1 + x}} \cdot \frac{1 - x}{\sqrt{1 + x}}\right)\right)}\right)
double f(double x) {
        double r20585 = 2.0;
        double r20586 = 1.0;
        double r20587 = x;
        double r20588 = r20586 - r20587;
        double r20589 = r20586 + r20587;
        double r20590 = r20588 / r20589;
        double r20591 = sqrt(r20590);
        double r20592 = atan(r20591);
        double r20593 = r20585 * r20592;
        return r20593;
}

double f(double x) {
        double r20594 = 2.0;
        double r20595 = 1.0;
        double r20596 = 1.0;
        double r20597 = x;
        double r20598 = r20596 + r20597;
        double r20599 = sqrt(r20598);
        double r20600 = r20595 / r20599;
        double r20601 = r20596 - r20597;
        double r20602 = r20601 / r20599;
        double r20603 = r20600 * r20602;
        double r20604 = log1p(r20603);
        double r20605 = expm1(r20604);
        double r20606 = sqrt(r20605);
        double r20607 = atan(r20606);
        double r20608 = r20594 * r20607;
        return r20608;
}

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. Using strategy rm
  7. Applied expm1-log1p-u0.0

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

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

Reproduce

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