Average Error: 0.2 → 0.1
Time: 2.4s
Precision: 64
\[\left(x \cdot x\right) \cdot \left(3 - x \cdot 2\right)\]
\[3 \cdot {x}^{2} - 2 \cdot {x}^{3}\]
\left(x \cdot x\right) \cdot \left(3 - x \cdot 2\right)
3 \cdot {x}^{2} - 2 \cdot {x}^{3}
double f(double x) {
        double r794557 = x;
        double r794558 = r794557 * r794557;
        double r794559 = 3.0;
        double r794560 = 2.0;
        double r794561 = r794557 * r794560;
        double r794562 = r794559 - r794561;
        double r794563 = r794558 * r794562;
        return r794563;
}

double f(double x) {
        double r794564 = 3.0;
        double r794565 = x;
        double r794566 = 2.0;
        double r794567 = pow(r794565, r794566);
        double r794568 = r794564 * r794567;
        double r794569 = 2.0;
        double r794570 = 3.0;
        double r794571 = pow(r794565, r794570);
        double r794572 = r794569 * r794571;
        double r794573 = r794568 - r794572;
        return r794573;
}

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.1
\[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. Taylor expanded around 0 0.1

    \[\leadsto \color{blue}{3 \cdot {x}^{2} - 2 \cdot {x}^{3}}\]
  8. Final simplification0.1

    \[\leadsto 3 \cdot {x}^{2} - 2 \cdot {x}^{3}\]

Reproduce

herbie shell --seed 2020064 
(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))))