?

Average Error: 0.0 → 0.0
Time: 3.9s
Precision: binary64
Cost: 448

?

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

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Initial program 0.0

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

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

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

    [Start]0.0

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

    rational_best_oopsla_all_46_json_45_simplify-36 [=>]0.0

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

    rational_best_oopsla_all_46_json_45_simplify-74 [=>]0.0

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

    rational_best_oopsla_all_46_json_45_simplify-102 [=>]0.0

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

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

Alternatives

Alternative 1
Error25.6
Cost784
\[\begin{array}{l} \mathbf{if}\;z \leq -2.7 \cdot 10^{-123}:\\ \;\;\;\;z\\ \mathbf{elif}\;z \leq 1.9 \cdot 10^{-90}:\\ \;\;\;\;y \cdot x\\ \mathbf{elif}\;z \leq 1.1 \cdot 10^{+137}:\\ \;\;\;\;z\\ \mathbf{elif}\;z \leq 5.2 \cdot 10^{+162}:\\ \;\;\;\;z \cdot \left(-x\right)\\ \mathbf{else}:\\ \;\;\;\;z\\ \end{array} \]
Alternative 2
Error15.9
Cost584
\[\begin{array}{l} t_0 := z \cdot \left(1 - x\right)\\ \mathbf{if}\;z \leq -2.9 \cdot 10^{-131}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 1.45 \cdot 10^{-99}:\\ \;\;\;\;y \cdot x\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 3
Error13.6
Cost584
\[\begin{array}{l} t_0 := z \cdot \left(1 - x\right)\\ \mathbf{if}\;z \leq -5.6 \cdot 10^{-125}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 2.5 \cdot 10^{-96}:\\ \;\;\;\;\left(y - z\right) \cdot x\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 4
Error0.9
Cost584
\[\begin{array}{l} t_0 := \left(y - z\right) \cdot x\\ \mathbf{if}\;x \leq -1:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 2.1 \cdot 10^{-11}:\\ \;\;\;\;y \cdot x + z\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 5
Error25.3
Cost456
\[\begin{array}{l} \mathbf{if}\;z \leq -5.6 \cdot 10^{-125}:\\ \;\;\;\;z\\ \mathbf{elif}\;z \leq 2.15 \cdot 10^{-94}:\\ \;\;\;\;y \cdot x\\ \mathbf{else}:\\ \;\;\;\;z\\ \end{array} \]
Alternative 6
Error34.9
Cost64
\[z \]

Error

Reproduce?

herbie shell --seed 2023090 
(FPCore (x y z)
  :name "Diagrams.Backend.Rasterific:$crender from diagrams-rasterific-1.3.1.3"
  :precision binary64
  (+ (* x y) (* (- 1.0 x) z)))