Average Error: 0.2 → 0.1
Time: 14.4s
Precision: 64
\[\left(x \cdot x\right) \cdot \left(3 - x \cdot 2\right)\]
\[\left(x \cdot x\right) \cdot 3 - 2 \cdot {x}^{3}\]
\left(x \cdot x\right) \cdot \left(3 - x \cdot 2\right)
\left(x \cdot x\right) \cdot 3 - 2 \cdot {x}^{3}
double f(double x) {
        double r52539231 = x;
        double r52539232 = r52539231 * r52539231;
        double r52539233 = 3.0;
        double r52539234 = 2.0;
        double r52539235 = r52539231 * r52539234;
        double r52539236 = r52539233 - r52539235;
        double r52539237 = r52539232 * r52539236;
        return r52539237;
}

double f(double x) {
        double r52539238 = x;
        double r52539239 = r52539238 * r52539238;
        double r52539240 = 3.0;
        double r52539241 = r52539239 * r52539240;
        double r52539242 = 2.0;
        double r52539243 = 3.0;
        double r52539244 = pow(r52539238, r52539243);
        double r52539245 = r52539242 * r52539244;
        double r52539246 = r52539241 - r52539245;
        return r52539246;
}

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. Simplified0.2

    \[\leadsto \color{blue}{\left(x \cdot x\right) \cdot 3 - 2 \cdot \left(\left(x \cdot x\right) \cdot x\right)}\]
  9. Using strategy rm
  10. Applied pow10.2

    \[\leadsto \left(x \cdot x\right) \cdot 3 - 2 \cdot \left(\left(x \cdot x\right) \cdot \color{blue}{{x}^{1}}\right)\]
  11. Applied pow10.2

    \[\leadsto \left(x \cdot x\right) \cdot 3 - 2 \cdot \left(\left(x \cdot \color{blue}{{x}^{1}}\right) \cdot {x}^{1}\right)\]
  12. Applied pow10.2

    \[\leadsto \left(x \cdot x\right) \cdot 3 - 2 \cdot \left(\left(\color{blue}{{x}^{1}} \cdot {x}^{1}\right) \cdot {x}^{1}\right)\]
  13. Applied pow-prod-up0.2

    \[\leadsto \left(x \cdot x\right) \cdot 3 - 2 \cdot \left(\color{blue}{{x}^{\left(1 + 1\right)}} \cdot {x}^{1}\right)\]
  14. Applied pow-prod-up0.1

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

    \[\leadsto \left(x \cdot x\right) \cdot 3 - 2 \cdot {x}^{\color{blue}{3}}\]
  16. Final simplification0.1

    \[\leadsto \left(x \cdot x\right) \cdot 3 - 2 \cdot {x}^{3}\]

Reproduce

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