?

Average Error: 0.0 → 0.0
Time: 13.7s
Precision: binary64
Cost: 576

?

\[\left(x + y\right) \cdot \left(z + 1\right) \]
\[z \cdot \left(y + x\right) + \left(y + x\right) \]
(FPCore (x y z) :precision binary64 (* (+ x y) (+ z 1.0)))
(FPCore (x y z) :precision binary64 (+ (* z (+ y x)) (+ y x)))
double code(double x, double y, double z) {
	return (x + y) * (z + 1.0);
}
double code(double x, double y, double z) {
	return (z * (y + x)) + (y + 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) * (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 * (y + x)) + (y + x)
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 * (y + x)) + (y + x);
}
def code(x, y, z):
	return (x + y) * (z + 1.0)
def code(x, y, z):
	return (z * (y + x)) + (y + x)
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(y + x)) + Float64(y + x))
end
function tmp = code(x, y, z)
	tmp = (x + y) * (z + 1.0);
end
function tmp = code(x, y, z)
	tmp = (z * (y + x)) + (y + x);
end
code[x_, y_, z_] := N[(N[(x + y), $MachinePrecision] * N[(z + 1.0), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_] := N[(N[(z * N[(y + x), $MachinePrecision]), $MachinePrecision] + N[(y + x), $MachinePrecision]), $MachinePrecision]
\left(x + y\right) \cdot \left(z + 1\right)
z \cdot \left(y + x\right) + \left(y + x\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. Taylor expanded in z around 0 0.0

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

    \[\leadsto \color{blue}{z \cdot \left(y + x\right) + \left(y + x\right)} \]
    Proof

    [Start]0.0

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

    rational.json-simplify-41 [=>]0.0

    \[ \color{blue}{\left(y + x\right) \cdot z + \left(x + y\right)} \]

    rational.json-simplify-1 [=>]0.0

    \[ \color{blue}{\left(x + y\right)} \cdot z + \left(x + y\right) \]

    rational.json-simplify-2 [=>]0.0

    \[ \color{blue}{z \cdot \left(x + y\right)} + \left(x + y\right) \]

    rational.json-simplify-1 [<=]0.0

    \[ z \cdot \color{blue}{\left(y + x\right)} + \left(x + y\right) \]

    rational.json-simplify-1 [<=]0.0

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

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

Alternatives

Alternative 1
Error32.7
Cost1380
\[\begin{array}{l} \mathbf{if}\;z \leq -1:\\ \;\;\;\;z \cdot y\\ \mathbf{elif}\;z \leq -2.1 \cdot 10^{-80}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq -7 \cdot 10^{-181}:\\ \;\;\;\;y\\ \mathbf{elif}\;z \leq -5.5 \cdot 10^{-265}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 1.15 \cdot 10^{-252}:\\ \;\;\;\;y\\ \mathbf{elif}\;z \leq 2.3 \cdot 10^{-123}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 1:\\ \;\;\;\;y\\ \mathbf{elif}\;z \leq 8 \cdot 10^{+137}:\\ \;\;\;\;z \cdot y\\ \mathbf{elif}\;z \leq 6.2 \cdot 10^{+292}:\\ \;\;\;\;z \cdot x\\ \mathbf{else}:\\ \;\;\;\;z \cdot y\\ \end{array} \]
Alternative 2
Error12.8
Cost720
\[\begin{array}{l} \mathbf{if}\;z \leq -1:\\ \;\;\;\;z \cdot y\\ \mathbf{elif}\;z \leq 180000:\\ \;\;\;\;y + x\\ \mathbf{elif}\;z \leq 2.9 \cdot 10^{+138}:\\ \;\;\;\;z \cdot y\\ \mathbf{elif}\;z \leq 9.2 \cdot 10^{+288}:\\ \;\;\;\;z \cdot x\\ \mathbf{else}:\\ \;\;\;\;z \cdot y\\ \end{array} \]
Alternative 3
Error12.2
Cost720
\[\begin{array}{l} t_0 := y \cdot \left(z - -1\right)\\ \mathbf{if}\;z \leq -1.45 \cdot 10^{-12}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 7.1 \cdot 10^{-6}:\\ \;\;\;\;y + x\\ \mathbf{elif}\;z \leq 2.6 \cdot 10^{+138}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 2.15 \cdot 10^{+284}:\\ \;\;\;\;z \cdot x\\ \mathbf{else}:\\ \;\;\;\;z \cdot y\\ \end{array} \]
Alternative 4
Error1.7
Cost584
\[\begin{array}{l} t_0 := \left(y + x\right) \cdot z\\ \mathbf{if}\;z \leq -1:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 1:\\ \;\;\;\;y + x\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 5
Error24.9
Cost452
\[\begin{array}{l} \mathbf{if}\;y \leq 5.8 \cdot 10^{-114}:\\ \;\;\;\;\left(1 + z\right) \cdot x\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(z - -1\right)\\ \end{array} \]
Alternative 6
Error0.0
Cost448
\[\left(x + y\right) \cdot \left(z + 1\right) \]
Alternative 7
Error39.1
Cost196
\[\begin{array}{l} \mathbf{if}\;y \leq 1.5 \cdot 10^{-114}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;y\\ \end{array} \]
Alternative 8
Error43.0
Cost64
\[x \]

Error

Reproduce?

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