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

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original0.3
Target0.2
Herbie0.2
\[6 \cdot x - 9 \cdot \left(x \cdot x\right)\]

Derivation

  1. Initial program 0.3

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

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

    \[\leadsto \color{blue}{6 \cdot x - 9 \cdot {x}^{2}}\]
  5. Using strategy rm
  6. Applied unpow20.2

    \[\leadsto 6 \cdot x - 9 \cdot \color{blue}{\left(x \cdot x\right)}\]
  7. Applied associate-*r*0.2

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

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

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

Reproduce

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

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

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