?

Average Accuracy: 100.0% → 100.0%
Time: 2.3s
Precision: binary64
Cost: 576

?

\[x \cdot y + \left(x - 1\right) \cdot z \]
\[x \cdot y + \left(x + -1\right) \cdot z \]
(FPCore (x y z) :precision binary64 (+ (* x y) (* (- x 1.0) z)))
(FPCore (x y z) :precision binary64 (+ (* x y) (* (+ x -1.0) z)))
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) + ((x + -1.0) * z);
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = (x * y) + ((x - 1.0d0) * z)
end function
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = (x * y) + ((x + (-1.0d0)) * z)
end function
public static double code(double x, double y, double z) {
	return (x * y) + ((x - 1.0) * z);
}
public static double code(double x, double y, double z) {
	return (x * y) + ((x + -1.0) * z);
}
def code(x, y, z):
	return (x * y) + ((x - 1.0) * z)
def code(x, y, z):
	return (x * y) + ((x + -1.0) * z)
function code(x, y, z)
	return Float64(Float64(x * y) + Float64(Float64(x - 1.0) * z))
end
function code(x, y, z)
	return Float64(Float64(x * y) + Float64(Float64(x + -1.0) * z))
end
function tmp = code(x, y, z)
	tmp = (x * y) + ((x - 1.0) * z);
end
function tmp = code(x, y, z)
	tmp = (x * y) + ((x + -1.0) * z);
end
code[x_, y_, z_] := N[(N[(x * y), $MachinePrecision] + N[(N[(x - 1.0), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_] := N[(N[(x * y), $MachinePrecision] + N[(N[(x + -1.0), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]
x \cdot y + \left(x - 1\right) \cdot z
x \cdot y + \left(x + -1\right) \cdot z

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Initial program 100.0%

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

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

Alternatives

Alternative 1
Accuracy89.1%
Cost585
\[\begin{array}{l} \mathbf{if}\;y \leq -5.5 \cdot 10^{-108} \lor \neg \left(y \leq 1.3 \cdot 10^{-121}\right):\\ \;\;\;\;x \cdot y - z\\ \mathbf{else}:\\ \;\;\;\;\left(x + -1\right) \cdot z\\ \end{array} \]
Alternative 2
Accuracy100.0%
Cost448
\[x \cdot \left(y + z\right) - z \]
Alternative 3
Accuracy63.8%
Cost320
\[\left(x + -1\right) \cdot z \]
Alternative 4
Accuracy45.5%
Cost128
\[-z \]

Error

Reproduce?

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