Average Error: 0.2 → 0.2
Time: 8.5s
Precision: 64
\[\left(x \cdot x\right) \cdot \left(3.0 - x \cdot 2.0\right)\]
\[x \cdot \left(x \cdot 3.0 - \left(2.0 \cdot x\right) \cdot x\right)\]
\left(x \cdot x\right) \cdot \left(3.0 - x \cdot 2.0\right)
x \cdot \left(x \cdot 3.0 - \left(2.0 \cdot x\right) \cdot x\right)
double f(double x) {
        double r15696783 = x;
        double r15696784 = r15696783 * r15696783;
        double r15696785 = 3.0;
        double r15696786 = 2.0;
        double r15696787 = r15696783 * r15696786;
        double r15696788 = r15696785 - r15696787;
        double r15696789 = r15696784 * r15696788;
        return r15696789;
}

double f(double x) {
        double r15696790 = x;
        double r15696791 = 3.0;
        double r15696792 = r15696790 * r15696791;
        double r15696793 = 2.0;
        double r15696794 = r15696793 * r15696790;
        double r15696795 = r15696794 * r15696790;
        double r15696796 = r15696792 - r15696795;
        double r15696797 = r15696790 * r15696796;
        return r15696797;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation

  1. Initial program 0.2

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

    \[\leadsto \color{blue}{x \cdot \left(x \cdot \left(3.0 - x \cdot 2.0\right)\right)}\]
  4. Using strategy rm
  5. Applied add-cube-cbrt0.5

    \[\leadsto x \cdot \left(x \cdot \color{blue}{\left(\left(\sqrt[3]{3.0 - x \cdot 2.0} \cdot \sqrt[3]{3.0 - x \cdot 2.0}\right) \cdot \sqrt[3]{3.0 - x \cdot 2.0}\right)}\right)\]
  6. Applied associate-*r*0.5

    \[\leadsto x \cdot \color{blue}{\left(\left(x \cdot \left(\sqrt[3]{3.0 - x \cdot 2.0} \cdot \sqrt[3]{3.0 - x \cdot 2.0}\right)\right) \cdot \sqrt[3]{3.0 - x \cdot 2.0}\right)}\]
  7. Taylor expanded around 0 0.2

    \[\leadsto x \cdot \color{blue}{\left(3.0 \cdot x - 2.0 \cdot {x}^{2}\right)}\]
  8. Simplified0.2

    \[\leadsto x \cdot \color{blue}{\left(x \cdot 3.0 - \left(2.0 \cdot x\right) \cdot x\right)}\]
  9. Final simplification0.2

    \[\leadsto x \cdot \left(x \cdot 3.0 - \left(2.0 \cdot x\right) \cdot x\right)\]

Reproduce

herbie shell --seed 2019156 +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))))