Average Error: 0.0 → 0.0
Time: 16.6s
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}{1 + x} - \frac{x}{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}{1 + x} - \frac{x}{1 + x}\right)\right)}\right)
double f(double x) {
        double r821720 = 2.0;
        double r821721 = 1.0;
        double r821722 = x;
        double r821723 = r821721 - r821722;
        double r821724 = r821721 + r821722;
        double r821725 = r821723 / r821724;
        double r821726 = sqrt(r821725);
        double r821727 = atan(r821726);
        double r821728 = r821720 * r821727;
        return r821728;
}

double f(double x) {
        double r821729 = 2.0;
        double r821730 = 1.0;
        double r821731 = x;
        double r821732 = r821730 + r821731;
        double r821733 = r821730 / r821732;
        double r821734 = r821731 / r821732;
        double r821735 = r821733 - r821734;
        double r821736 = log1p(r821735);
        double r821737 = expm1(r821736);
        double r821738 = sqrt(r821737);
        double r821739 = atan(r821738);
        double r821740 = r821729 * r821739;
        return r821740;
}

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. Using strategy rm
  5. Applied div-sub0.0

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

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

Reproduce

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