Average Error: 0.5 → 0.5
Time: 23.9s
Precision: 64
\[\cos^{-1} \left(\frac{1 - 5 \cdot \left(v \cdot v\right)}{v \cdot v - 1}\right)\]
\[\mathsf{expm1}\left(\mathsf{log1p}\left(\cos^{-1} \left(\frac{\mathsf{fma}\left(-5 \cdot v, v, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)\right)\right)\]
\cos^{-1} \left(\frac{1 - 5 \cdot \left(v \cdot v\right)}{v \cdot v - 1}\right)
\mathsf{expm1}\left(\mathsf{log1p}\left(\cos^{-1} \left(\frac{\mathsf{fma}\left(-5 \cdot v, v, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)\right)\right)
double f(double v) {
        double r4658671 = 1.0;
        double r4658672 = 5.0;
        double r4658673 = v;
        double r4658674 = r4658673 * r4658673;
        double r4658675 = r4658672 * r4658674;
        double r4658676 = r4658671 - r4658675;
        double r4658677 = r4658674 - r4658671;
        double r4658678 = r4658676 / r4658677;
        double r4658679 = acos(r4658678);
        return r4658679;
}

double f(double v) {
        double r4658680 = -5.0;
        double r4658681 = v;
        double r4658682 = r4658680 * r4658681;
        double r4658683 = 1.0;
        double r4658684 = fma(r4658682, r4658681, r4658683);
        double r4658685 = -1.0;
        double r4658686 = fma(r4658681, r4658681, r4658685);
        double r4658687 = r4658684 / r4658686;
        double r4658688 = acos(r4658687);
        double r4658689 = log1p(r4658688);
        double r4658690 = expm1(r4658689);
        return r4658690;
}

Error

Bits error versus v

Derivation

  1. Initial program 0.5

    \[\cos^{-1} \left(\frac{1 - 5 \cdot \left(v \cdot v\right)}{v \cdot v - 1}\right)\]
  2. Simplified0.5

    \[\leadsto \color{blue}{\cos^{-1} \left(\frac{\mathsf{fma}\left(-5 \cdot v, v, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)}\]
  3. Using strategy rm
  4. Applied expm1-log1p-u0.5

    \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\cos^{-1} \left(\frac{\mathsf{fma}\left(-5 \cdot v, v, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)\right)\right)}\]
  5. Final simplification0.5

    \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\cos^{-1} \left(\frac{\mathsf{fma}\left(-5 \cdot v, v, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)\right)\right)\]

Reproduce

herbie shell --seed 2019138 +o rules:numerics
(FPCore (v)
  :name "Falkner and Boettcher, Appendix B, 1"
  (acos (/ (- 1 (* 5 (* v v))) (- (* v v) 1))))