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

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)\]

Alternatives

Alternative 1
Error2.0
Cost648
\[\begin{array}{l} \mathbf{if}\;x \leq -0.6588229518975612 \lor \neg \left(x \leq 0.668949580901031\right):\\ \;\;\;\;x \cdot \left(x \cdot -9\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot 6\\ \end{array}\]
Alternative 2
Error22.0
Cost192
\[x \cdot 6\]
Alternative 3
Error61.2
Cost64
\[-1\]
Alternative 4
Error61.3
Cost64
\[0\]
Alternative 5
Error62.2
Cost64
\[1\]

Error

Derivation

  1. Initial program 0.3

    \[\left(3 \cdot \left(2 - x \cdot 3\right)\right) \cdot x\]
  2. Simplified0.2

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

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

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

Reproduce

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