Average Error: 0.5 → 0.5
Time: 35.5s
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 r4005702 = 1.0;
        double r4005703 = 5.0;
        double r4005704 = v;
        double r4005705 = r4005704 * r4005704;
        double r4005706 = r4005703 * r4005705;
        double r4005707 = r4005702 - r4005706;
        double r4005708 = r4005705 - r4005702;
        double r4005709 = r4005707 / r4005708;
        double r4005710 = acos(r4005709);
        return r4005710;
}

double f(double v) {
        double r4005711 = -5.0;
        double r4005712 = v;
        double r4005713 = r4005711 * r4005712;
        double r4005714 = 1.0;
        double r4005715 = fma(r4005713, r4005712, r4005714);
        double r4005716 = -1.0;
        double r4005717 = fma(r4005712, r4005712, r4005716);
        double r4005718 = r4005715 / r4005717;
        double r4005719 = acos(r4005718);
        double r4005720 = log1p(r4005719);
        double r4005721 = expm1(r4005720);
        return r4005721;
}

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 2019149 +o rules:numerics
(FPCore (v)
  :name "Falkner and Boettcher, Appendix B, 1"
  (acos (/ (- 1 (* 5 (* v v))) (- (* v v) 1))))