Average Error: 0.2 → 0.2
Time: 3.6s
Precision: 64
\[\left(3 \cdot \left(2 - x \cdot 3\right)\right) \cdot x\]
\[6 \cdot x - 9 \cdot {x}^{2}\]
\left(3 \cdot \left(2 - x \cdot 3\right)\right) \cdot x
6 \cdot x - 9 \cdot {x}^{2}
double code(double x) {
	return ((3.0 * (2.0 - (x * 3.0))) * x);
}
double code(double x) {
	return ((6.0 * x) - (9.0 * pow(x, 2.0)));
}

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

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

    \[\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. Using strategy rm
  8. Applied add-cube-cbrt0.5

    \[\leadsto \left(\sqrt[3]{3} \cdot \sqrt[3]{3}\right) \cdot \left(\sqrt[3]{\color{blue}{\left(\sqrt[3]{3} \cdot \sqrt[3]{3}\right) \cdot \sqrt[3]{3}}} \cdot \left(\left(2 - x \cdot 3\right) \cdot x\right)\right)\]
  9. Applied cbrt-prod0.5

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

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

    \[\leadsto \color{blue}{6 \cdot x - 9 \cdot {x}^{2}}\]
  12. Final simplification0.2

    \[\leadsto 6 \cdot x - 9 \cdot {x}^{2}\]

Reproduce

herbie shell --seed 2020079 +o rules:numerics
(FPCore (x)
  :name "Diagrams.Tangent:$catParam from diagrams-lib-1.3.0.3, E"
  :precision binary64

  :herbie-target
  (- (* 6 x) (* 9 (* x x)))

  (* (* 3 (- 2 (* x 3))) x))