?

Average Error: 0.0 → 0.0
Time: 7.2s
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_best.json-simplify-1 [=>]0.0

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

    rational_best.json-simplify-43 [=>]0.0

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

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

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

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

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

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

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

    rational_best.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.6
Cost1512
\[\begin{array}{l} \mathbf{if}\;z \leq -1.15 \cdot 10^{+170}:\\ \;\;\;\;z \cdot x\\ \mathbf{elif}\;z \leq -1.6 \cdot 10^{+38}:\\ \;\;\;\;z \cdot y\\ \mathbf{elif}\;z \leq -1:\\ \;\;\;\;z \cdot x\\ \mathbf{elif}\;z \leq -2.9 \cdot 10^{-69}:\\ \;\;\;\;y\\ \mathbf{elif}\;z \leq -1.4 \cdot 10^{-93}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq -1.7 \cdot 10^{-178}:\\ \;\;\;\;y\\ \mathbf{elif}\;z \leq 4.4 \cdot 10^{-225}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 1.4 \cdot 10^{-168}:\\ \;\;\;\;y\\ \mathbf{elif}\;z \leq 2.9 \cdot 10^{-16}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 7 \cdot 10^{+108}:\\ \;\;\;\;z \cdot y\\ \mathbf{else}:\\ \;\;\;\;z \cdot x\\ \end{array} \]
Alternative 2
Error32.2
Cost1248
\[\begin{array}{l} \mathbf{if}\;z \leq -1:\\ \;\;\;\;z \cdot x\\ \mathbf{elif}\;z \leq -9.2 \cdot 10^{-70}:\\ \;\;\;\;y\\ \mathbf{elif}\;z \leq -5.7 \cdot 10^{-92}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq -1.4 \cdot 10^{-178}:\\ \;\;\;\;y\\ \mathbf{elif}\;z \leq 2.2 \cdot 10^{-221}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 1.7 \cdot 10^{-168}:\\ \;\;\;\;y\\ \mathbf{elif}\;z \leq 2.25 \cdot 10^{-66}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 360000:\\ \;\;\;\;y\\ \mathbf{else}:\\ \;\;\;\;z \cdot x\\ \end{array} \]
Alternative 3
Error13.2
Cost852
\[\begin{array}{l} \mathbf{if}\;z \leq -3.9 \cdot 10^{+171}:\\ \;\;\;\;z \cdot x\\ \mathbf{elif}\;z \leq -9.2 \cdot 10^{+38}:\\ \;\;\;\;z \cdot y\\ \mathbf{elif}\;z \leq -1:\\ \;\;\;\;z \cdot x\\ \mathbf{elif}\;z \leq 1.35:\\ \;\;\;\;y + x\\ \mathbf{elif}\;z \leq 5.6 \cdot 10^{+103}:\\ \;\;\;\;z \cdot y\\ \mathbf{else}:\\ \;\;\;\;z \cdot x\\ \end{array} \]
Alternative 4
Error12.8
Cost848
\[\begin{array}{l} t_0 := y \cdot \left(z - -1\right)\\ \mathbf{if}\;z \leq -2.6 \cdot 10^{+170}:\\ \;\;\;\;z \cdot x\\ \mathbf{elif}\;z \leq -0.00325:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 1.1 \cdot 10^{-7}:\\ \;\;\;\;y + x\\ \mathbf{elif}\;z \leq 5.4 \cdot 10^{+106}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;z \cdot x\\ \end{array} \]
Alternative 5
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 6
Error39.4
Cost460
\[\begin{array}{l} \mathbf{if}\;y \leq 2.4 \cdot 10^{-81}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 0.00155:\\ \;\;\;\;y\\ \mathbf{elif}\;y \leq 960000000000:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;y\\ \end{array} \]
Alternative 7
Error0.0
Cost448
\[\left(x + y\right) \cdot \left(z + 1\right) \]
Alternative 8
Error44.0
Cost64
\[x \]

Error

Reproduce?

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