Average Error: 0.0 → 0.0
Time: 7.7s
Precision: 64
\[2 \cdot \tan^{-1} \left(\sqrt{\frac{1 - x}{1 + x}}\right)\]
\[2 \cdot \tan^{-1} \left(\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{\frac{1 - x}{1 + x}}\right)\right)\right)\]
2 \cdot \tan^{-1} \left(\sqrt{\frac{1 - x}{1 + x}}\right)
2 \cdot \tan^{-1} \left(\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{\frac{1 - x}{1 + x}}\right)\right)\right)
double f(double x) {
        double r20893 = 2.0;
        double r20894 = 1.0;
        double r20895 = x;
        double r20896 = r20894 - r20895;
        double r20897 = r20894 + r20895;
        double r20898 = r20896 / r20897;
        double r20899 = sqrt(r20898);
        double r20900 = atan(r20899);
        double r20901 = r20893 * r20900;
        return r20901;
}

double f(double x) {
        double r20902 = 2.0;
        double r20903 = 1.0;
        double r20904 = x;
        double r20905 = r20903 - r20904;
        double r20906 = r20903 + r20904;
        double r20907 = r20905 / r20906;
        double r20908 = sqrt(r20907);
        double r20909 = log1p(r20908);
        double r20910 = expm1(r20909);
        double r20911 = atan(r20910);
        double r20912 = r20902 * r20911;
        return r20912;
}

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} \color{blue}{\left(\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{\frac{1 - x}{1 + x}}\right)\right)\right)}\]
  4. Final simplification0.0

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

Reproduce

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