Average Error: 0.0 → 0.0
Time: 4.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. Final simplification0.0

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

Alternatives

Alternative 1
Error26.4
Cost1248
\[\begin{array}{l} t_0 := y \cdot \left(-x\right)\\ \mathbf{if}\;x \leq -6 \cdot 10^{+28}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq -1.05 \cdot 10^{-73}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq -1.1 \cdot 10^{-96}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 2.05 \cdot 10^{-163}:\\ \;\;\;\;z \cdot y\\ \mathbf{elif}\;x \leq 1.65 \cdot 10^{-146}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 2.4 \cdot 10^{-48}:\\ \;\;\;\;z \cdot y\\ \mathbf{elif}\;x \leq 12.6:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 1.25 \cdot 10^{+57}:\\ \;\;\;\;z \cdot y\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 2
Error12.6
Cost584
\[\begin{array}{l} t_0 := y \cdot \left(z - x\right)\\ \mathbf{if}\;y \leq -6.5 \cdot 10^{-57}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 5.3 \cdot 10^{-39}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 3
Error0.9
Cost584
\[\begin{array}{l} t_0 := y \cdot \left(z - x\right)\\ \mathbf{if}\;y \leq -28.5:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 1:\\ \;\;\;\;x + z \cdot y\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 4
Error23.9
Cost456
\[\begin{array}{l} \mathbf{if}\;y \leq -8.2 \cdot 10^{-58}:\\ \;\;\;\;z \cdot y\\ \mathbf{elif}\;y \leq 1.12 \cdot 10^{-38}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;z \cdot y\\ \end{array} \]
Alternative 5
Error0.0
Cost448
\[x + y \cdot \left(z - x\right) \]
Alternative 6
Error34.6
Cost64
\[x \]

Error

Reproduce

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