?

Average Error: 0.0 → 0.2
Time: 12.3s
Precision: binary64
Cost: 960

?

\[x + \left(y - x\right) \cdot z \]
\[x + \frac{z \cdot \left(x \cdot 8 - 4 \cdot \left(x + y\right)\right)}{-4} \]
(FPCore (x y z) :precision binary64 (+ x (* (- y x) z)))
(FPCore (x y z)
 :precision binary64
 (+ x (/ (* z (- (* x 8.0) (* 4.0 (+ x y)))) -4.0)))
double code(double x, double y, double z) {
	return x + ((y - x) * z);
}
double code(double x, double y, double z) {
	return x + ((z * ((x * 8.0) - (4.0 * (x + y)))) / -4.0);
}
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 * ((x * 8.0d0) - (4.0d0 * (x + y)))) / (-4.0d0))
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 * ((x * 8.0) - (4.0 * (x + y)))) / -4.0);
}
def code(x, y, z):
	return x + ((y - x) * z)
def code(x, y, z):
	return x + ((z * ((x * 8.0) - (4.0 * (x + y)))) / -4.0)
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 * Float64(Float64(x * 8.0) - Float64(4.0 * Float64(x + y)))) / -4.0))
end
function tmp = code(x, y, z)
	tmp = x + ((y - x) * z);
end
function tmp = code(x, y, z)
	tmp = x + ((z * ((x * 8.0) - (4.0 * (x + y)))) / -4.0);
end
code[x_, y_, z_] := N[(x + N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_] := N[(x + N[(N[(z * N[(N[(x * 8.0), $MachinePrecision] - N[(4.0 * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / -4.0), $MachinePrecision]), $MachinePrecision]
x + \left(y - x\right) \cdot z
x + \frac{z \cdot \left(x \cdot 8 - 4 \cdot \left(x + y\right)\right)}{-4}

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.2

    \[\leadsto x + \color{blue}{\frac{z \cdot \left(\left(x + x\right) \cdot 4 - 2 \cdot \left(2 \cdot \left(y + x\right)\right)\right)}{-4}} \]
  3. Simplified0.2

    \[\leadsto x + \color{blue}{\frac{z \cdot \left(x \cdot 8 - 4 \cdot \left(x + y\right)\right)}{-4}} \]
    Proof

    [Start]0.2

    \[ x + \frac{z \cdot \left(\left(x + x\right) \cdot 4 - 2 \cdot \left(2 \cdot \left(y + x\right)\right)\right)}{-4} \]

    rational_best-simplify-1 [=>]0.2

    \[ x + \frac{z \cdot \left(\color{blue}{4 \cdot \left(x + x\right)} - 2 \cdot \left(2 \cdot \left(y + x\right)\right)\right)}{-4} \]

    rational_best-simplify-63 [<=]0.2

    \[ x + \frac{z \cdot \left(\color{blue}{\left(x \cdot 4 + x \cdot 4\right)} - 2 \cdot \left(2 \cdot \left(y + x\right)\right)\right)}{-4} \]

    rational_best-simplify-1 [=>]0.2

    \[ x + \frac{z \cdot \left(\left(\color{blue}{4 \cdot x} + x \cdot 4\right) - 2 \cdot \left(2 \cdot \left(y + x\right)\right)\right)}{-4} \]

    rational_best-simplify-1 [=>]0.2

    \[ x + \frac{z \cdot \left(\left(4 \cdot x + \color{blue}{4 \cdot x}\right) - 2 \cdot \left(2 \cdot \left(y + x\right)\right)\right)}{-4} \]

    rational_best-simplify-63 [=>]0.2

    \[ x + \frac{z \cdot \left(\color{blue}{x \cdot \left(4 + 4\right)} - 2 \cdot \left(2 \cdot \left(y + x\right)\right)\right)}{-4} \]

    metadata-eval [=>]0.2

    \[ x + \frac{z \cdot \left(x \cdot \color{blue}{8} - 2 \cdot \left(2 \cdot \left(y + x\right)\right)\right)}{-4} \]

    rational_best-simplify-50 [=>]0.2

    \[ x + \frac{z \cdot \left(x \cdot 8 - \color{blue}{\left(y + x\right) \cdot \left(2 \cdot 2\right)}\right)}{-4} \]

    metadata-eval [=>]0.2

    \[ x + \frac{z \cdot \left(x \cdot 8 - \left(y + x\right) \cdot \color{blue}{4}\right)}{-4} \]

    rational_best-simplify-1 [=>]0.2

    \[ x + \frac{z \cdot \left(x \cdot 8 - \color{blue}{4 \cdot \left(y + x\right)}\right)}{-4} \]

    rational_best-simplify-3 [=>]0.2

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

    \[\leadsto x + \frac{z \cdot \left(x \cdot 8 - 4 \cdot \left(x + y\right)\right)}{-4} \]

Alternatives

Alternative 1
Error8.8
Cost648
\[\begin{array}{l} t_0 := x + z \cdot \left(-x\right)\\ \mathbf{if}\;x \leq -1.45 \cdot 10^{-81}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 9.5 \cdot 10^{-44}:\\ \;\;\;\;x + z \cdot y\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 2
Error0.0
Cost448
\[x + \left(y - x\right) \cdot z \]
Alternative 3
Error11.9
Cost320
\[x + z \cdot y \]

Error

Reproduce?

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