?

Average Error: 0.0 → 0.0
Time: 3.6s
Precision: binary64
Cost: 704

?

\[x \cdot y + \left(x - 1\right) \cdot z \]
\[x \cdot y + \left(-1 \cdot z + z \cdot x\right) \]
(FPCore (x y z) :precision binary64 (+ (* x y) (* (- x 1.0) z)))
(FPCore (x y z) :precision binary64 (+ (* x y) (+ (* -1.0 z) (* z x))))
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) + ((-1.0 * z) + (z * x));
}
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) + (((-1.0d0) * z) + (z * x))
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) + ((-1.0 * z) + (z * x));
}
def code(x, y, z):
	return (x * y) + ((x - 1.0) * z)
def code(x, y, z):
	return (x * y) + ((-1.0 * z) + (z * x))
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(-1.0 * z) + Float64(z * x)))
end
function tmp = code(x, y, z)
	tmp = (x * y) + ((x - 1.0) * z);
end
function tmp = code(x, y, z)
	tmp = (x * y) + ((-1.0 * z) + (z * x));
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[(-1.0 * z), $MachinePrecision] + N[(z * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
x \cdot y + \left(x - 1\right) \cdot z
x \cdot y + \left(-1 \cdot z + z \cdot x\right)

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Initial program 0.0

    \[x \cdot y + \left(x - 1\right) \cdot z \]
  2. Taylor expanded in x around 0 0.0

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

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

Alternatives

Alternative 1
Error1.3
Cost712
\[\begin{array}{l} \mathbf{if}\;x \leq -5200000000:\\ \;\;\;\;\left(y + z\right) \cdot x\\ \mathbf{elif}\;x \leq 5.8 \cdot 10^{-10}:\\ \;\;\;\;x \cdot y + \left(-z\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot y + z \cdot x\\ \end{array} \]
Alternative 2
Error1.3
Cost648
\[\begin{array}{l} t_0 := \left(y + z\right) \cdot x\\ \mathbf{if}\;x \leq -5200000000:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 5.8 \cdot 10^{-10}:\\ \;\;\;\;x \cdot y + \left(-z\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 3
Error0.0
Cost576
\[x \cdot y + \left(x - 1\right) \cdot z \]
Alternative 4
Error35.1
Cost456
\[\begin{array}{l} \mathbf{if}\;y \leq -2.6 \cdot 10^{-144}:\\ \;\;\;\;y \cdot x\\ \mathbf{elif}\;y \leq 5.8 \cdot 10^{-163}:\\ \;\;\;\;z \cdot x\\ \mathbf{else}:\\ \;\;\;\;y \cdot x\\ \end{array} \]
Alternative 5
Error28.7
Cost320
\[\left(y + z\right) \cdot x \]
Alternative 6
Error39.4
Cost192
\[y \cdot x \]

Error

Reproduce?

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