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

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 0.0

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

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

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

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

Alternatives

Alternative 1
Error24.5
Cost1048
\[\begin{array}{l} t_0 := x \cdot \left(-y\right)\\ \mathbf{if}\;y \leq -3.3 \cdot 10^{+61}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -9.724035835310091 \cdot 10^{-20}:\\ \;\;\;\;z \cdot y\\ \mathbf{elif}\;y \leq -1.6085522984754358 \cdot 10^{-41}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq -2.9361684641037914 \cdot 10^{-64}:\\ \;\;\;\;z \cdot y\\ \mathbf{elif}\;y \leq 2.9604313304089513 \cdot 10^{-9}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 1.55 \cdot 10^{+68}:\\ \;\;\;\;z \cdot y\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 2
Error12.8
Cost848
\[\begin{array}{l} t_0 := y \cdot \left(z - x\right)\\ \mathbf{if}\;y \leq -9.724035835310091 \cdot 10^{-20}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -1.6085522984754358 \cdot 10^{-41}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq -2.9361684641037914 \cdot 10^{-64}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 0.18471694051643106:\\ \;\;\;\;x - x \cdot y\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 3
Error23.8
Cost720
\[\begin{array}{l} \mathbf{if}\;y \leq -9.724035835310091 \cdot 10^{-20}:\\ \;\;\;\;z \cdot y\\ \mathbf{elif}\;y \leq -1.6085522984754358 \cdot 10^{-41}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq -2.9361684641037914 \cdot 10^{-64}:\\ \;\;\;\;z \cdot y\\ \mathbf{elif}\;y \leq 2.9604313304089513 \cdot 10^{-9}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;z \cdot y\\ \end{array} \]
Alternative 4
Error1.2
Cost712
\[\begin{array}{l} t_0 := z \cdot y - x \cdot y\\ \mathbf{if}\;y \leq -7583582632270.308:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 0.18471694051643106:\\ \;\;\;\;x + z \cdot y\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 5
Error17.0
Cost584
\[\begin{array}{l} t_0 := x - x \cdot y\\ \mathbf{if}\;x \leq -1.6297861924041065 \cdot 10^{-178}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 5.868118068219038 \cdot 10^{-32}:\\ \;\;\;\;z \cdot y\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 6
Error1.2
Cost584
\[\begin{array}{l} t_0 := y \cdot \left(z - x\right)\\ \mathbf{if}\;y \leq -7583582632270.308:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 0.18471694051643106:\\ \;\;\;\;x + z \cdot y\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 7
Error0.0
Cost448
\[x + y \cdot \left(z - x\right) \]
Alternative 8
Error35.2
Cost64
\[x \]

Error

Reproduce

herbie shell --seed 2022297 
(FPCore (x y z)
  :name "SynthBasics:oscSampleBasedAux from YampaSynth-0.2"
  :precision binary64
  (+ x (* y (- z x))))