Average Error: 0.5 → 0.5
Time: 17.2s
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 r2737043 = 1.0;
        double r2737044 = 5.0;
        double r2737045 = v;
        double r2737046 = r2737045 * r2737045;
        double r2737047 = r2737044 * r2737046;
        double r2737048 = r2737043 - r2737047;
        double r2737049 = r2737046 - r2737043;
        double r2737050 = r2737048 / r2737049;
        double r2737051 = acos(r2737050);
        return r2737051;
}

double f(double v) {
        double r2737052 = -5.0;
        double r2737053 = v;
        double r2737054 = r2737052 * r2737053;
        double r2737055 = 1.0;
        double r2737056 = fma(r2737054, r2737053, r2737055);
        double r2737057 = -1.0;
        double r2737058 = fma(r2737053, r2737053, r2737057);
        double r2737059 = r2737056 / r2737058;
        double r2737060 = acos(r2737059);
        double r2737061 = log1p(r2737060);
        double r2737062 = expm1(r2737061);
        return r2737062;
}

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