Average Error: 0.5 → 0.6
Time: 53.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{1}{\mathsf{fma}\left(v, v, -1\right)} \cdot \mathsf{fma}\left(-5 \cdot 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{1}{\mathsf{fma}\left(v, v, -1\right)} \cdot \mathsf{fma}\left(-5 \cdot v, v, 1\right)\right)\right)\right)
double f(double v) {
        double r6177494 = 1.0;
        double r6177495 = 5.0;
        double r6177496 = v;
        double r6177497 = r6177496 * r6177496;
        double r6177498 = r6177495 * r6177497;
        double r6177499 = r6177494 - r6177498;
        double r6177500 = r6177497 - r6177494;
        double r6177501 = r6177499 / r6177500;
        double r6177502 = acos(r6177501);
        return r6177502;
}

double f(double v) {
        double r6177503 = 1.0;
        double r6177504 = v;
        double r6177505 = -1.0;
        double r6177506 = fma(r6177504, r6177504, r6177505);
        double r6177507 = r6177503 / r6177506;
        double r6177508 = -5.0;
        double r6177509 = r6177508 * r6177504;
        double r6177510 = fma(r6177509, r6177504, r6177503);
        double r6177511 = r6177507 * r6177510;
        double r6177512 = acos(r6177511);
        double r6177513 = log1p(r6177512);
        double r6177514 = expm1(r6177513);
        return r6177514;
}

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. Using strategy rm
  6. Applied div-inv0.6

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

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

Reproduce

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