Average Error: 0.5 → 0.5
Time: 16.6s
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 r2537483 = 1.0;
        double r2537484 = 5.0;
        double r2537485 = v;
        double r2537486 = r2537485 * r2537485;
        double r2537487 = r2537484 * r2537486;
        double r2537488 = r2537483 - r2537487;
        double r2537489 = r2537486 - r2537483;
        double r2537490 = r2537488 / r2537489;
        double r2537491 = acos(r2537490);
        return r2537491;
}

double f(double v) {
        double r2537492 = -5.0;
        double r2537493 = v;
        double r2537494 = r2537492 * r2537493;
        double r2537495 = 1.0;
        double r2537496 = fma(r2537494, r2537493, r2537495);
        double r2537497 = -1.0;
        double r2537498 = fma(r2537493, r2537493, r2537497);
        double r2537499 = r2537496 / r2537498;
        double r2537500 = acos(r2537499);
        double r2537501 = log1p(r2537500);
        double r2537502 = expm1(r2537501);
        return r2537502;
}

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