Average Error: 0.1 → 0.1
Time: 5.4s
Precision: binary64
Cost: 576
\[x \cdot \left(y + z\right) + z \cdot 5\]
\[x \cdot y + z \cdot \left(x + 5\right)\]
x \cdot \left(y + z\right) + z \cdot 5
x \cdot y + z \cdot \left(x + 5\right)
(FPCore (x y z) :precision binary64 (+ (* x (+ y z)) (* z 5.0)))
(FPCore (x y z) :precision binary64 (+ (* x y) (* z (+ x 5.0))))
double code(double x, double y, double z) {
	return (x * (y + z)) + (z * 5.0);
}
double code(double x, double y, double z) {
	return (x * y) + (z * (x + 5.0));
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original0.1
Target0.1
Herbie0.1
\[\left(x + 5\right) \cdot z + x \cdot y\]

Alternatives

Alternative 1
Error1.0
Cost776
\[\begin{array}{l} \mathbf{if}\;x \leq -5.026282814293944 \lor \neg \left(x \leq 2.0114589857942678 \cdot 10^{-06}\right):\\ \;\;\;\;x \cdot \left(y + z\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot y + z \cdot 5\\ \end{array}\]
Alternative 2
Error1.1
Cost776
\[\begin{array}{l} \mathbf{if}\;x \leq -5.026282814293944 \lor \neg \left(x \leq 2.0114589857942678 \cdot 10^{-06}\right):\\ \;\;\;\;x \cdot \left(y + z\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot y + \frac{z}{0.2}\\ \end{array}\]
Alternative 3
Error12.5
Cost648
\[\begin{array}{l} \mathbf{if}\;x \leq -565496177364692.6 \lor \neg \left(x \leq 2.1845142003323496 \cdot 10^{-38}\right):\\ \;\;\;\;x \cdot \left(y + z\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(x + 5\right)\\ \end{array}\]
Alternative 4
Error19.0
Cost1932
\[\begin{array}{l} \mathbf{if}\;y \leq -1.050798223962226 \cdot 10^{+131}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;y \leq 4.417178571254344 \cdot 10^{+21}:\\ \;\;\;\;z \cdot \left(x + 5\right)\\ \mathbf{elif}\;y \leq 3.040603856798374 \cdot 10^{+43}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;y \leq 4.175646833467339 \cdot 10^{+59}:\\ \;\;\;\;z \cdot 5\\ \mathbf{elif}\;y \leq 1.6660486706183525 \cdot 10^{+104} \lor \neg \left(y \leq 8.2222813910697 \cdot 10^{+122}\right):\\ \;\;\;\;x \cdot y\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(x + 5\right)\\ \end{array}\]
Alternative 5
Error23.5
Cost520
\[\begin{array}{l} \mathbf{if}\;x \leq -1.7523004913474226 \cdot 10^{-19} \lor \neg \left(x \leq 1.0119030701395858 \cdot 10^{-36}\right):\\ \;\;\;\;x \cdot y\\ \mathbf{else}:\\ \;\;\;\;z \cdot 5\\ \end{array}\]
Alternative 6
Error39.6
Cost192
\[x \cdot y\]
Alternative 7
Error61.8
Cost64
\[1\]

Error

Derivation

  1. Initial program 0.1

    \[x \cdot \left(y + z\right) + z \cdot 5\]
  2. Using strategy rm
  3. Applied distribute-rgt-in_binary64_102580.1

    \[\leadsto \color{blue}{\left(y \cdot x + z \cdot x\right)} + z \cdot 5\]
  4. Applied associate-+l+_binary64_102410.1

    \[\leadsto \color{blue}{y \cdot x + \left(z \cdot x + z \cdot 5\right)}\]
  5. Simplified0.1

    \[\leadsto y \cdot x + \color{blue}{z \cdot \left(x + 5\right)}\]
  6. Simplified0.1

    \[\leadsto \color{blue}{x \cdot y + z \cdot \left(x + 5\right)}\]
  7. Final simplification0.1

    \[\leadsto x \cdot y + z \cdot \left(x + 5\right)\]

Reproduce

herbie shell --seed 2021044 
(FPCore (x y z)
  :name "Graphics.Rendering.Plot.Render.Plot.Legend:renderLegendOutside from plot-0.2.3.4, C"
  :precision binary64

  :herbie-target
  (+ (* (+ x 5.0) z) (* x y))

  (+ (* x (+ y z)) (* z 5.0)))