Average Error: 0.2 → 0.2
Time: 3.2s
Precision: 64
\[\left(x \cdot x\right) \cdot \left(3 - x \cdot 2\right)\]
\[x \cdot \frac{\left(x \cdot \left(3 - x \cdot 2\right)\right) \cdot \mathsf{fma}\left(2, x, 3\right)}{3 + x \cdot 2}\]
\left(x \cdot x\right) \cdot \left(3 - x \cdot 2\right)
x \cdot \frac{\left(x \cdot \left(3 - x \cdot 2\right)\right) \cdot \mathsf{fma}\left(2, x, 3\right)}{3 + x \cdot 2}
double f(double x) {
        double r653693 = x;
        double r653694 = r653693 * r653693;
        double r653695 = 3.0;
        double r653696 = 2.0;
        double r653697 = r653693 * r653696;
        double r653698 = r653695 - r653697;
        double r653699 = r653694 * r653698;
        return r653699;
}

double f(double x) {
        double r653700 = x;
        double r653701 = 3.0;
        double r653702 = 2.0;
        double r653703 = r653700 * r653702;
        double r653704 = r653701 - r653703;
        double r653705 = r653700 * r653704;
        double r653706 = fma(r653702, r653700, r653701);
        double r653707 = r653705 * r653706;
        double r653708 = r653701 + r653703;
        double r653709 = r653707 / r653708;
        double r653710 = r653700 * r653709;
        return r653710;
}

Error

Bits error versus x

Target

Original0.2
Target0.2
Herbie0.2
\[x \cdot \left(x \cdot \left(3 - x \cdot 2\right)\right)\]

Derivation

  1. Initial program 0.2

    \[\left(x \cdot x\right) \cdot \left(3 - x \cdot 2\right)\]
  2. Using strategy rm
  3. Applied associate-*l*0.2

    \[\leadsto \color{blue}{x \cdot \left(x \cdot \left(3 - x \cdot 2\right)\right)}\]
  4. Using strategy rm
  5. Applied flip--0.2

    \[\leadsto x \cdot \left(x \cdot \color{blue}{\frac{3 \cdot 3 - \left(x \cdot 2\right) \cdot \left(x \cdot 2\right)}{3 + x \cdot 2}}\right)\]
  6. Applied associate-*r/0.2

    \[\leadsto x \cdot \color{blue}{\frac{x \cdot \left(3 \cdot 3 - \left(x \cdot 2\right) \cdot \left(x \cdot 2\right)\right)}{3 + x \cdot 2}}\]
  7. Simplified0.2

    \[\leadsto x \cdot \frac{\color{blue}{\left(x \cdot \left(3 - x \cdot 2\right)\right) \cdot \mathsf{fma}\left(2, x, 3\right)}}{3 + x \cdot 2}\]
  8. Final simplification0.2

    \[\leadsto x \cdot \frac{\left(x \cdot \left(3 - x \cdot 2\right)\right) \cdot \mathsf{fma}\left(2, x, 3\right)}{3 + x \cdot 2}\]

Reproduce

herbie shell --seed 2020034 +o rules:numerics
(FPCore (x)
  :name "Data.Spline.Key:interpolateKeys from smoothie-0.4.0.2"
  :precision binary64

  :herbie-target
  (* x (* x (- 3 (* x 2))))

  (* (* x x) (- 3 (* x 2))))