?

Average Accuracy: 100.0% → 100.0%
Time: 5.2s
Precision: binary64
Cost: 576

?

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

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Initial program 100.0%

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

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

    [Start]100.0

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

    *-commutative [=>]100.0

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

    sub-neg [=>]100.0

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

    distribute-lft-in [=>]100.0

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

    +-commutative [=>]100.0

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

    *-commutative [<=]100.0

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

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

Alternatives

Alternative 1
Accuracy62.4%
Cost1181
\[\begin{array}{l} t_0 := z \cdot \left(-x\right)\\ \mathbf{if}\;z \leq -7.8 \cdot 10^{+183}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -1.22 \cdot 10^{+95}:\\ \;\;\;\;z \cdot y\\ \mathbf{elif}\;z \leq -3.1 \cdot 10^{+33}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -2.7 \cdot 10^{-12}:\\ \;\;\;\;z \cdot y\\ \mathbf{elif}\;z \leq 2.8 \cdot 10^{-12}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 1.45 \cdot 10^{+83} \lor \neg \left(z \leq 3.6 \cdot 10^{+195}\right):\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;z \cdot y\\ \end{array} \]
Alternative 2
Accuracy75.5%
Cost585
\[\begin{array}{l} \mathbf{if}\;x \leq -1.28 \cdot 10^{-138} \lor \neg \left(x \leq 4.2 \cdot 10^{-54}\right):\\ \;\;\;\;x \cdot \left(1 - z\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot y\\ \end{array} \]
Alternative 3
Accuracy79.2%
Cost585
\[\begin{array}{l} \mathbf{if}\;x \leq -2.4 \cdot 10^{-137} \lor \neg \left(x \leq 2.6 \cdot 10^{-50}\right):\\ \;\;\;\;x \cdot \left(1 - z\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(y - x\right)\\ \end{array} \]
Alternative 4
Accuracy98.6%
Cost585
\[\begin{array}{l} \mathbf{if}\;z \leq -1 \lor \neg \left(z \leq 2.8 \cdot 10^{-12}\right):\\ \;\;\;\;z \cdot \left(y - x\right)\\ \mathbf{else}:\\ \;\;\;\;x + z \cdot y\\ \end{array} \]
Alternative 5
Accuracy61.1%
Cost456
\[\begin{array}{l} \mathbf{if}\;x \leq -2.1 \cdot 10^{-137}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 10^{-29}:\\ \;\;\;\;z \cdot y\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 6
Accuracy100.0%
Cost448
\[x + z \cdot \left(y - x\right) \]
Alternative 7
Accuracy45.1%
Cost64
\[x \]

Error

Reproduce?

herbie shell --seed 2023136 
(FPCore (x y z)
  :name "Diagrams.ThreeD.Shapes:frustum from diagrams-lib-1.3.0.3, B"
  :precision binary64
  (+ x (* (- y x) z)))