Average Error: 0.0 → 0.0
Time: 7.0s
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
Error24.7
Cost1312
\[\begin{array}{l} t_0 := x \cdot \left(-y\right)\\ \mathbf{if}\;y \leq -3.3 \cdot 10^{+134}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -9.2 \cdot 10^{+55}:\\ \;\;\;\;z \cdot y\\ \mathbf{elif}\;y \leq -1.2032559811338807 \cdot 10^{+20}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -4.8161371390310954 \cdot 10^{-95}:\\ \;\;\;\;z \cdot y\\ \mathbf{elif}\;y \leq 4.178891821039126 \cdot 10^{-7}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 5 \cdot 10^{+52}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 7.2 \cdot 10^{+114}:\\ \;\;\;\;z \cdot y\\ \mathbf{elif}\;y \leq 8 \cdot 10^{+224}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;z \cdot y\\ \end{array} \]
Alternative 2
Error1.0
Cost712
\[\begin{array}{l} t_0 := z \cdot y - x \cdot y\\ \mathbf{if}\;y \leq -1.929044516582242:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 4.178891821039126 \cdot 10^{-7}:\\ \;\;\;\;x + z \cdot y\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 3
Error16.0
Cost584
\[\begin{array}{l} t_0 := x - x \cdot y\\ \mathbf{if}\;x \leq -2.625295009350199 \cdot 10^{-100}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 1.2715348785243181 \cdot 10^{-58}:\\ \;\;\;\;z \cdot y\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 4
Error13.0
Cost584
\[\begin{array}{l} t_0 := y \cdot \left(z - x\right)\\ \mathbf{if}\;y \leq -4.8161371390310954 \cdot 10^{-95}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 251950121222.91455:\\ \;\;\;\;x - x \cdot y\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 5
Error1.0
Cost584
\[\begin{array}{l} t_0 := y \cdot \left(z - x\right)\\ \mathbf{if}\;y \leq -1.929044516582242:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 4.178891821039126 \cdot 10^{-7}:\\ \;\;\;\;x + z \cdot y\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 6
Error24.8
Cost456
\[\begin{array}{l} \mathbf{if}\;y \leq -4.8161371390310954 \cdot 10^{-95}:\\ \;\;\;\;z \cdot y\\ \mathbf{elif}\;y \leq 4.178891821039126 \cdot 10^{-7}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;z \cdot y\\ \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 2022317 
(FPCore (x y z)
  :name "SynthBasics:oscSampleBasedAux from YampaSynth-0.2"
  :precision binary64
  (+ x (* y (- z x))))