Average Error: 0.2 → 0.2
Time: 9.9s
Precision: 64
\[\left(3 \cdot \left(2 - x \cdot 3\right)\right) \cdot x\]
\[x \cdot 6 - \left(9 \cdot x\right) \cdot x\]
\left(3 \cdot \left(2 - x \cdot 3\right)\right) \cdot x
x \cdot 6 - \left(9 \cdot x\right) \cdot x
double f(double x) {
        double r35380062 = 3.0;
        double r35380063 = 2.0;
        double r35380064 = x;
        double r35380065 = r35380064 * r35380062;
        double r35380066 = r35380063 - r35380065;
        double r35380067 = r35380062 * r35380066;
        double r35380068 = r35380067 * r35380064;
        return r35380068;
}

double f(double x) {
        double r35380069 = x;
        double r35380070 = 6.0;
        double r35380071 = r35380069 * r35380070;
        double r35380072 = 9.0;
        double r35380073 = r35380072 * r35380069;
        double r35380074 = r35380073 * r35380069;
        double r35380075 = r35380071 - r35380074;
        return r35380075;
}

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
\[6 \cdot x - 9 \cdot \left(x \cdot x\right)\]

Derivation

  1. Initial program 0.2

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

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

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

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

    \[\leadsto \color{blue}{6 \cdot x - 9 \cdot {x}^{2}}\]
  8. Simplified0.2

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

    \[\leadsto x \cdot 6 - \left(9 \cdot x\right) \cdot x\]

Reproduce

herbie shell --seed 2019179 
(FPCore (x)
  :name "Diagrams.Tangent:$catParam from diagrams-lib-1.3.0.3, E"

  :herbie-target
  (- (* 6.0 x) (* 9.0 (* x x)))

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