Average Error: 0.3 → 0.2
Time: 1.7s
Precision: binary64
\[\left(3 \cdot \left(2 - x \cdot 3\right)\right) \cdot x\]
\[x \cdot 6 + x \cdot \left(x \cdot -9\right)\]
\left(3 \cdot \left(2 - x \cdot 3\right)\right) \cdot x
x \cdot 6 + x \cdot \left(x \cdot -9\right)
(FPCore (x) :precision binary64 (* (* 3.0 (- 2.0 (* x 3.0))) x))
(FPCore (x) :precision binary64 (+ (* x 6.0) (* x (* 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 * (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)\]

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. Using strategy rm
  4. Applied distribute-lft-in_binary640.2

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

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

Reproduce

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