?

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

?

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

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(1 - z\right) \]
  2. Applied egg-rr0.0

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

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

    [Start]0.0

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

    rational_best_oopsla_all_46_json_45_simplify-107 [<=]0.0

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

    rational_best_oopsla_all_46_json_45_simplify-108 [=>]0.0

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

    rational_best_oopsla_all_46_json_45_simplify-74 [=>]0.0

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

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

Alternatives

Alternative 1
Error13.0
Cost1360
\[\begin{array}{l} t_0 := \left(-z\right) \cdot x\\ t_1 := y \cdot \left(1 - z\right)\\ \mathbf{if}\;1 - z \leq -2 \cdot 10^{+111}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;1 - z \leq 0.999:\\ \;\;\;\;t_1\\ \mathbf{elif}\;1 - z \leq 1.005:\\ \;\;\;\;y + x\\ \mathbf{elif}\;1 - z \leq 5 \cdot 10^{+169}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 2
Error12.7
Cost980
\[\begin{array}{l} t_0 := \left(1 - z\right) \cdot x\\ \mathbf{if}\;z \leq -9.5 \cdot 10^{+171}:\\ \;\;\;\;\left(-z\right) \cdot x\\ \mathbf{elif}\;z \leq -4.9 \cdot 10^{+38}:\\ \;\;\;\;z \cdot \left(-y\right)\\ \mathbf{elif}\;z \leq -6.6 \cdot 10^{-10}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 1.55 \cdot 10^{-6}:\\ \;\;\;\;y + x\\ \mathbf{elif}\;z \leq 3 \cdot 10^{+105}:\\ \;\;\;\;y \cdot \left(1 - z\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 3
Error12.7
Cost980
\[\begin{array}{l} \mathbf{if}\;z \leq -2.6 \cdot 10^{+170}:\\ \;\;\;\;\left(-z\right) \cdot x\\ \mathbf{elif}\;z \leq -3.95 \cdot 10^{+40}:\\ \;\;\;\;z \cdot \left(-y\right)\\ \mathbf{elif}\;z \leq -6.6 \cdot 10^{-10}:\\ \;\;\;\;x - z \cdot x\\ \mathbf{elif}\;z \leq 5.2 \cdot 10^{-6}:\\ \;\;\;\;y + x\\ \mathbf{elif}\;z \leq 3.4 \cdot 10^{+104}:\\ \;\;\;\;y \cdot \left(1 - z\right)\\ \mathbf{else}:\\ \;\;\;\;\left(1 - z\right) \cdot x\\ \end{array} \]
Alternative 4
Error13.1
Cost916
\[\begin{array}{l} t_0 := \left(-z\right) \cdot x\\ t_1 := z \cdot \left(-y\right)\\ \mathbf{if}\;z \leq -1.4 \cdot 10^{+175}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -2.9 \cdot 10^{+40}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -230:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 1:\\ \;\;\;\;y + x\\ \mathbf{elif}\;z \leq 4.5 \cdot 10^{+103}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 5
Error1.7
Cost648
\[\begin{array}{l} t_0 := \left(y + x\right) \cdot \left(-z\right)\\ \mathbf{if}\;z \leq -1:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 1:\\ \;\;\;\;y + x\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 6
Error0.0
Cost576
\[\left(x + y\right) - \left(x + y\right) \cdot z \]
Alternative 7
Error13.7
Cost520
\[\begin{array}{l} t_0 := z \cdot \left(-y\right)\\ \mathbf{if}\;z \leq -7 \cdot 10^{+14}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 1:\\ \;\;\;\;y + x\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 8
Error39.4
Cost460
\[\begin{array}{l} \mathbf{if}\;y \leq 3.85 \cdot 10^{-72}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 0.00172:\\ \;\;\;\;y\\ \mathbf{elif}\;y \leq 102000000000:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;y\\ \end{array} \]
Alternative 9
Error0.0
Cost448
\[\left(x + y\right) \cdot \left(1 - z\right) \]
Alternative 10
Error24.2
Cost192
\[y + x \]
Alternative 11
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, H"
  :precision binary64
  (* (+ x y) (- 1.0 z)))