Average Error: 0.0 → 0.0
Time: 8.5s
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 r18970 = 2.0;
        double r18971 = 1.0;
        double r18972 = x;
        double r18973 = r18971 - r18972;
        double r18974 = r18971 + r18972;
        double r18975 = r18973 / r18974;
        double r18976 = sqrt(r18975);
        double r18977 = atan(r18976);
        double r18978 = r18970 * r18977;
        return r18978;
}

double f(double x) {
        double r18979 = 2.0;
        double r18980 = 1.0;
        double r18981 = x;
        double r18982 = r18980 - r18981;
        double r18983 = r18980 + r18981;
        double r18984 = r18982 / r18983;
        double r18985 = sqrt(r18984);
        double r18986 = log1p(r18985);
        double r18987 = expm1(r18986);
        double r18988 = atan(r18987);
        double r18989 = r18979 * r18988;
        return r18989;
}

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 2019325 +o rules:numerics
(FPCore (x)
  :name "arccos"
  :precision binary64
  (* 2 (atan (sqrt (/ (- 1 x) (+ 1 x))))))