Average Error: 0.0 → 0.0
Time: 5.8s
Precision: binary64
Cost: 576
\[\left(x + y\right) \cdot \left(z + 1\right) \]
\[z \cdot \left(x + y\right) + \left(x + y\right) \]
(FPCore (x y z) :precision binary64 (* (+ x y) (+ z 1.0)))
(FPCore (x y z) :precision binary64 (+ (* z (+ x y)) (+ x y)))
double code(double x, double y, double z) {
	return (x + y) * (z + 1.0);
}
double code(double x, double y, double z) {
	return (z * (x + y)) + (x + y);
}
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) * (z + 1.0d0)
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 = (z * (x + y)) + (x + y)
end function
public static double code(double x, double y, double z) {
	return (x + y) * (z + 1.0);
}
public static double code(double x, double y, double z) {
	return (z * (x + y)) + (x + y);
}
def code(x, y, z):
	return (x + y) * (z + 1.0)
def code(x, y, z):
	return (z * (x + y)) + (x + y)
function code(x, y, z)
	return Float64(Float64(x + y) * Float64(z + 1.0))
end
function code(x, y, z)
	return Float64(Float64(z * Float64(x + y)) + Float64(x + y))
end
function tmp = code(x, y, z)
	tmp = (x + y) * (z + 1.0);
end
function tmp = code(x, y, z)
	tmp = (z * (x + y)) + (x + y);
end
code[x_, y_, z_] := N[(N[(x + y), $MachinePrecision] * N[(z + 1.0), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_] := N[(N[(z * N[(x + y), $MachinePrecision]), $MachinePrecision] + N[(x + y), $MachinePrecision]), $MachinePrecision]
\left(x + y\right) \cdot \left(z + 1\right)
z \cdot \left(x + y\right) + \left(x + y\right)

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 0.0

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

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

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

Alternatives

Alternative 1
Error32.4
Cost1116
\[\begin{array}{l} \mathbf{if}\;z \leq -2.5 \cdot 10^{+253}:\\ \;\;\;\;y \cdot z\\ \mathbf{elif}\;z \leq -5 \cdot 10^{+69}:\\ \;\;\;\;x \cdot z\\ \mathbf{elif}\;z \leq -31.478184482420488:\\ \;\;\;\;y \cdot z\\ \mathbf{elif}\;z \leq -1.1290394694002773 \cdot 10^{-173}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq -1.5542405588429804 \cdot 10^{-298}:\\ \;\;\;\;y\\ \mathbf{elif}\;z \leq 1.994141835013185 \cdot 10^{-235}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 1740856969152453.8:\\ \;\;\;\;y\\ \mathbf{else}:\\ \;\;\;\;y \cdot z\\ \end{array} \]
Alternative 2
Error12.5
Cost980
\[\begin{array}{l} t_0 := y + y \cdot z\\ \mathbf{if}\;z \leq -2.5 \cdot 10^{+253}:\\ \;\;\;\;y \cdot z\\ \mathbf{elif}\;z \leq -5 \cdot 10^{+69}:\\ \;\;\;\;x \cdot z\\ \mathbf{elif}\;z \leq -36111370392.179504:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -0.035807130882869256:\\ \;\;\;\;x \cdot \left(z + 1\right)\\ \mathbf{elif}\;z \leq 5.528043891926385 \cdot 10^{-19}:\\ \;\;\;\;x + y\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 3
Error12.5
Cost848
\[\begin{array}{l} t_0 := y + y \cdot z\\ \mathbf{if}\;z \leq -2.5 \cdot 10^{+253}:\\ \;\;\;\;y \cdot z\\ \mathbf{elif}\;z \leq -5 \cdot 10^{+69}:\\ \;\;\;\;x \cdot z\\ \mathbf{elif}\;z \leq -4.017554387597311 \cdot 10^{-9}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 5.528043891926385 \cdot 10^{-19}:\\ \;\;\;\;x + y\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 4
Error12.7
Cost720
\[\begin{array}{l} \mathbf{if}\;z \leq -2.5 \cdot 10^{+253}:\\ \;\;\;\;y \cdot z\\ \mathbf{elif}\;z \leq -5 \cdot 10^{+69}:\\ \;\;\;\;x \cdot z\\ \mathbf{elif}\;z \leq -31.478184482420488:\\ \;\;\;\;y \cdot z\\ \mathbf{elif}\;z \leq 1740856969152453.8:\\ \;\;\;\;x + y\\ \mathbf{else}:\\ \;\;\;\;y \cdot z\\ \end{array} \]
Alternative 5
Error1.5
Cost584
\[\begin{array}{l} t_0 := z \cdot \left(x + y\right)\\ \mathbf{if}\;z \leq -31.478184482420488:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 0.018921147035074054:\\ \;\;\;\;x + y\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 6
Error38.4
Cost460
\[\begin{array}{l} \mathbf{if}\;x \leq -3 \cdot 10^{+89}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq -1.7777300221429666 \cdot 10^{-13}:\\ \;\;\;\;x \cdot z\\ \mathbf{elif}\;x \leq -2.1176365809792705 \cdot 10^{-46}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;y\\ \end{array} \]
Alternative 7
Error0.0
Cost448
\[\left(z + 1\right) \cdot \left(x + y\right) \]
Alternative 8
Error38.8
Cost196
\[\begin{array}{l} \mathbf{if}\;y \leq 8.756464250608995 \cdot 10^{-96}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;y\\ \end{array} \]
Alternative 9
Error42.8
Cost64
\[y \]

Error

Reproduce

herbie shell --seed 2022316 
(FPCore (x y z)
  :name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, G"
  :precision binary64
  (* (+ x y) (+ z 1.0)))