Average Error: 0.0 → 0.0
Time: 4.9s
Precision: binary64
Cost: 576
\[x \cdot y + \left(x - 1\right) \cdot z\]
\[x \cdot y + z \cdot \left(x - 1\right)\]
x \cdot y + \left(x - 1\right) \cdot z
x \cdot y + z \cdot \left(x - 1\right)
(FPCore (x y z) :precision binary64 (+ (* x y) (* (- x 1.0) z)))
(FPCore (x y z) :precision binary64 (+ (* x y) (* z (- x 1.0))))
double code(double x, double y, double z) {
	return (x * y) + ((x - 1.0) * z);
}
double code(double x, double y, double z) {
	return (x * y) + (z * (x - 1.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

Alternatives

Alternative 1
Error0.0
Cost448
\[x \cdot \left(y + z\right) - z\]
Alternative 2
Error1.5
Cost648
\[\begin{array}{l} \mathbf{if}\;x \leq -0.991866159979669 \lor \neg \left(x \leq 1.2686507449661718 \cdot 10^{-23}\right):\\ \;\;\;\;x \cdot \left(y + z\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot y - z\\ \end{array}\]
Alternative 3
Error7.3
Cost648
\[\begin{array}{l} \mathbf{if}\;y \leq -1.212521104282855 \cdot 10^{-38} \lor \neg \left(y \leq 2.8756048946800847 \cdot 10^{-84}\right):\\ \;\;\;\;x \cdot y - z\\ \mathbf{else}:\\ \;\;\;\;x \cdot z - z\\ \end{array}\]
Alternative 4
Error12.0
Cost320
\[x \cdot y - z\]
Alternative 5
Error29.4
Cost785
\[\begin{array}{l} \mathbf{if}\;y \leq -1.2175369473581856 \cdot 10^{-40} \lor \neg \left(y \leq 1.504966979763987 \cdot 10^{-74} \lor \neg \left(y \leq 2.3936200402628776 \cdot 10^{+64}\right) \land y \leq 4.2228592406086 \cdot 10^{+177}\right):\\ \;\;\;\;x \cdot y\\ \mathbf{else}:\\ \;\;\;\;-z\\ \end{array}\]
Alternative 6
Error35.0
Cost128
\[-z\]
Alternative 7
Error61.8
Cost64
\[1\]

Error

Derivation

  1. Initial program 0.0

    \[x \cdot y + \left(x - 1\right) \cdot z\]
  2. Simplified0.0

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

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

Reproduce

herbie shell --seed 2021044 
(FPCore (x y z)
  :name "Graphics.Rendering.Chart.Drawing:drawTextsR from Chart-1.5.3"
  :precision binary64
  (+ (* x y) (* (- x 1.0) z)))