Average Error: 0.2 → 0.2
Time: 13.3s
Precision: 64
\[\left(x \cdot x\right) \cdot \left(3.0 - x \cdot 2.0\right)\]
\[\frac{x \cdot \left(3.0 \cdot 3.0 - \left(2.0 \cdot x\right) \cdot \left(2.0 \cdot x\right)\right)}{3.0 + 2.0 \cdot x} \cdot x\]
\left(x \cdot x\right) \cdot \left(3.0 - x \cdot 2.0\right)
\frac{x \cdot \left(3.0 \cdot 3.0 - \left(2.0 \cdot x\right) \cdot \left(2.0 \cdot x\right)\right)}{3.0 + 2.0 \cdot x} \cdot x
double f(double x) {
        double r35559354 = x;
        double r35559355 = r35559354 * r35559354;
        double r35559356 = 3.0;
        double r35559357 = 2.0;
        double r35559358 = r35559354 * r35559357;
        double r35559359 = r35559356 - r35559358;
        double r35559360 = r35559355 * r35559359;
        return r35559360;
}

double f(double x) {
        double r35559361 = x;
        double r35559362 = 3.0;
        double r35559363 = r35559362 * r35559362;
        double r35559364 = 2.0;
        double r35559365 = r35559364 * r35559361;
        double r35559366 = r35559365 * r35559365;
        double r35559367 = r35559363 - r35559366;
        double r35559368 = r35559361 * r35559367;
        double r35559369 = r35559362 + r35559365;
        double r35559370 = r35559368 / r35559369;
        double r35559371 = r35559370 * r35559361;
        return r35559371;
}

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

    \[\leadsto \color{blue}{3.0 \cdot {x}^{2} - 2.0 \cdot {x}^{3}}\]
  3. Simplified0.2

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

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

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

    \[\leadsto \frac{x \cdot \left(3.0 \cdot 3.0 - \left(2.0 \cdot x\right) \cdot \left(2.0 \cdot x\right)\right)}{3.0 + 2.0 \cdot x} \cdot x\]

Reproduce

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