Average Error: 0.0 → 0.0
Time: 7.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 0.0

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

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

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

Alternatives

Alternative 1
Error1.0
Cost712
\[\begin{array}{l} t_0 := z \cdot y - x \cdot z\\ \mathbf{if}\;z \leq -74365371.24979533:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 4.262321529900886 \cdot 10^{-8}:\\ \;\;\;\;x + z \cdot y\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 2
Error17.1
Cost584
\[\begin{array}{l} t_0 := x - x \cdot z\\ \mathbf{if}\;x \leq -5.594168104867363 \cdot 10^{-104}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 9.289504036318504 \cdot 10^{+23}:\\ \;\;\;\;z \cdot y\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 3
Error9.4
Cost584
\[\begin{array}{l} t_0 := x - x \cdot z\\ \mathbf{if}\;x \leq -1.1068163066662685 \cdot 10^{+52}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 9.6 \cdot 10^{+110}:\\ \;\;\;\;x + z \cdot y\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 4
Error1.0
Cost584
\[\begin{array}{l} t_0 := z \cdot \left(y - x\right)\\ \mathbf{if}\;z \leq -74365371.24979533:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 4.262321529900886 \cdot 10^{-8}:\\ \;\;\;\;x + z \cdot y\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 5
Error24.7
Cost456
\[\begin{array}{l} \mathbf{if}\;x \leq -3.581408467595153 \cdot 10^{-102}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 9.289504036318504 \cdot 10^{+23}:\\ \;\;\;\;z \cdot y\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 6
Error0.0
Cost448
\[x + z \cdot \left(y - x\right) \]
Alternative 7
Error35.1
Cost64
\[x \]

Error

Reproduce

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