Average Error: 0.2 → 0.2
Time: 19.0s
Precision: 64
\[\left(x \cdot x\right) \cdot \left(3 - x \cdot 2\right)\]
\[\left(\mathsf{fma}\left(\sqrt[3]{3} \cdot \sqrt[3]{3}, \sqrt[3]{3}, 2 \cdot \left(-x\right)\right) \cdot x + x \cdot \mathsf{fma}\left(-2, x, 2 \cdot x\right)\right) \cdot x\]
\left(x \cdot x\right) \cdot \left(3 - x \cdot 2\right)
\left(\mathsf{fma}\left(\sqrt[3]{3} \cdot \sqrt[3]{3}, \sqrt[3]{3}, 2 \cdot \left(-x\right)\right) \cdot x + x \cdot \mathsf{fma}\left(-2, x, 2 \cdot x\right)\right) \cdot x
double f(double x) {
        double r36687122 = x;
        double r36687123 = r36687122 * r36687122;
        double r36687124 = 3.0;
        double r36687125 = 2.0;
        double r36687126 = r36687122 * r36687125;
        double r36687127 = r36687124 - r36687126;
        double r36687128 = r36687123 * r36687127;
        return r36687128;
}

double f(double x) {
        double r36687129 = 3.0;
        double r36687130 = cbrt(r36687129);
        double r36687131 = r36687130 * r36687130;
        double r36687132 = 2.0;
        double r36687133 = x;
        double r36687134 = -r36687133;
        double r36687135 = r36687132 * r36687134;
        double r36687136 = fma(r36687131, r36687130, r36687135);
        double r36687137 = r36687136 * r36687133;
        double r36687138 = -r36687132;
        double r36687139 = r36687132 * r36687133;
        double r36687140 = fma(r36687138, r36687133, r36687139);
        double r36687141 = r36687133 * r36687140;
        double r36687142 = r36687137 + r36687141;
        double r36687143 = r36687142 * r36687133;
        return r36687143;
}

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 add-cube-cbrt0.2

    \[\leadsto x \cdot \left(x \cdot \left(\color{blue}{\left(\sqrt[3]{3} \cdot \sqrt[3]{3}\right) \cdot \sqrt[3]{3}} - x \cdot 2\right)\right)\]
  6. Applied prod-diff0.2

    \[\leadsto x \cdot \left(x \cdot \color{blue}{\left(\mathsf{fma}\left(\sqrt[3]{3} \cdot \sqrt[3]{3}, \sqrt[3]{3}, -2 \cdot x\right) + \mathsf{fma}\left(-2, x, 2 \cdot x\right)\right)}\right)\]
  7. Applied distribute-lft-in0.2

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

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

Reproduce

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

  :herbie-target
  (* x (* x (- 3.0 (* x 2.0))))

  (* (* x x) (- 3.0 (* x 2.0))))