Average Error: 0.0 → 0.0
Time: 9.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(\log \left(e^{\frac{1 - x}{1 + x}}\right)\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(\log \left(e^{\frac{1 - x}{1 + x}}\right)\right)\right)}\right)
double f(double x) {
        double r21871 = 2.0;
        double r21872 = 1.0;
        double r21873 = x;
        double r21874 = r21872 - r21873;
        double r21875 = r21872 + r21873;
        double r21876 = r21874 / r21875;
        double r21877 = sqrt(r21876);
        double r21878 = atan(r21877);
        double r21879 = r21871 * r21878;
        return r21879;
}

double f(double x) {
        double r21880 = 2.0;
        double r21881 = 1.0;
        double r21882 = x;
        double r21883 = r21881 - r21882;
        double r21884 = r21881 + r21882;
        double r21885 = r21883 / r21884;
        double r21886 = exp(r21885);
        double r21887 = log(r21886);
        double r21888 = log1p(r21887);
        double r21889 = expm1(r21888);
        double r21890 = sqrt(r21889);
        double r21891 = atan(r21890);
        double r21892 = r21880 * r21891;
        return r21892;
}

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 add-log-exp0.0

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

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

Reproduce

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