?

Average Error: 0.02% → 0.02%
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.02

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

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

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

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

Alternatives

Alternative 1
Error36.28%
Cost1313
\[\begin{array}{l} t_0 := x \cdot \left(-y\right)\\ \mathbf{if}\;y \leq -1.1 \cdot 10^{+226}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -7.6 \cdot 10^{+144}:\\ \;\;\;\;z \cdot y\\ \mathbf{elif}\;y \leq -5.8 \cdot 10^{+85}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -1.4 \cdot 10^{-24}:\\ \;\;\;\;z \cdot y\\ \mathbf{elif}\;y \leq 4.5 \cdot 10^{-24}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 2.9 \cdot 10^{+54} \lor \neg \left(y \leq 4.9 \cdot 10^{+150}\right) \land y \leq 2.15 \cdot 10^{+215}:\\ \;\;\;\;z \cdot y\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 2
Error18.98%
Cost1049
\[\begin{array}{l} t_0 := x \cdot \left(-y\right)\\ t_1 := x + z \cdot y\\ \mathbf{if}\;y \leq -5.8 \cdot 10^{+233}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -6.2 \cdot 10^{+141}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -1.75 \cdot 10^{+97}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 2.95 \cdot 10^{+54}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 4.5 \cdot 10^{+151} \lor \neg \left(y \leq 2 \cdot 10^{+221}\right):\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;z \cdot y\\ \end{array} \]
Alternative 3
Error10.82%
Cost585
\[\begin{array}{l} \mathbf{if}\;z \leq -3.8 \cdot 10^{-94} \lor \neg \left(z \leq 1.35 \cdot 10^{-127}\right):\\ \;\;\;\;x + z \cdot y\\ \mathbf{else}:\\ \;\;\;\;x - x \cdot y\\ \end{array} \]
Alternative 4
Error36.31%
Cost456
\[\begin{array}{l} \mathbf{if}\;y \leq -1.1 \cdot 10^{-24}:\\ \;\;\;\;z \cdot y\\ \mathbf{elif}\;y \leq 1.16 \cdot 10^{-20}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;z \cdot y\\ \end{array} \]
Alternative 5
Error0.02%
Cost448
\[x + y \cdot \left(z - x\right) \]
Alternative 6
Error54.41%
Cost64
\[x \]

Error

Reproduce?

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