?

Average Error: 0.02% → 0.03%
Time: 7.2s
Precision: binary64
Cost: 576

?

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

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Initial program 0.02

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

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

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

Alternatives

Alternative 1
Error20.26%
Cost1360
\[\begin{array}{l} t_0 := x \cdot \left(-z\right)\\ 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:\\ \;\;\;\;x + y\\ \mathbf{elif}\;1 - z \leq 5 \cdot 10^{+169}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 2
Error19.84%
Cost980
\[\begin{array}{l} t_0 := x \cdot \left(1 - z\right)\\ \mathbf{if}\;z \leq -9.5 \cdot 10^{+171}:\\ \;\;\;\;x \cdot \left(-z\right)\\ \mathbf{elif}\;z \leq -4.9 \cdot 10^{+38}:\\ \;\;\;\;y \cdot \left(-z\right)\\ \mathbf{elif}\;z \leq -6.6 \cdot 10^{-10}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 1.55 \cdot 10^{-6}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;z \leq 3 \cdot 10^{+105}:\\ \;\;\;\;y \cdot \left(1 - z\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 3
Error19.77%
Cost980
\[\begin{array}{l} \mathbf{if}\;z \leq -2.6 \cdot 10^{+170}:\\ \;\;\;\;x \cdot \left(-z\right)\\ \mathbf{elif}\;z \leq -3.95 \cdot 10^{+40}:\\ \;\;\;\;y \cdot \left(-z\right)\\ \mathbf{elif}\;z \leq -6.6 \cdot 10^{-10}:\\ \;\;\;\;x - x \cdot z\\ \mathbf{elif}\;z \leq 5.2 \cdot 10^{-6}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;z \leq 3.4 \cdot 10^{+104}:\\ \;\;\;\;y \cdot \left(1 - z\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(1 - z\right)\\ \end{array} \]
Alternative 4
Error20.48%
Cost916
\[\begin{array}{l} t_0 := x \cdot \left(-z\right)\\ t_1 := y \cdot \left(-z\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:\\ \;\;\;\;x + y\\ \mathbf{elif}\;z \leq 4.5 \cdot 10^{+103}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 5
Error2.69%
Cost649
\[\begin{array}{l} \mathbf{if}\;z \leq -1 \lor \neg \left(z \leq 1\right):\\ \;\;\;\;z \cdot \left(\left(-y\right) - x\right)\\ \mathbf{else}:\\ \;\;\;\;x + y\\ \end{array} \]
Alternative 6
Error20.41%
Cost521
\[\begin{array}{l} \mathbf{if}\;z \leq -18 \lor \neg \left(z \leq 1\right):\\ \;\;\;\;x \cdot \left(-z\right)\\ \mathbf{else}:\\ \;\;\;\;x + y\\ \end{array} \]
Alternative 7
Error61.58%
Cost460
\[\begin{array}{l} \mathbf{if}\;y \leq 7.8 \cdot 10^{-73}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 0.00186:\\ \;\;\;\;y\\ \mathbf{elif}\;y \leq 95000000000:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;y\\ \end{array} \]
Alternative 8
Error0.02%
Cost448
\[\left(1 - z\right) \cdot \left(x + y\right) \]
Alternative 9
Error37.89%
Cost192
\[x + y \]
Alternative 10
Error68.7%
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)))