?

Average Error: 0.1 → 0.1
Time: 6.0s
Precision: binary64
Cost: 832

?

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

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Initial program 0.1

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

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

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

    [Start]0.1

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

    rational_best.json-simplify-2 [=>]0.1

    \[ \left(x + y \cdot \color{blue}{\left(z \cdot 4\right)}\right) + \left(-y \cdot \left(z \cdot 8\right)\right) \]
  4. Taylor expanded in x around 0 0.1

    \[\leadsto \color{blue}{\left(4 \cdot \left(y \cdot z\right) + x\right) - 8 \cdot \left(y \cdot z\right)} \]
  5. Simplified0.1

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

    [Start]0.1

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

    rational_best.json-simplify-44 [=>]0.1

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

    rational_best.json-simplify-2 [=>]0.1

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

    rational_best.json-simplify-44 [=>]0.1

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

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

Alternatives

Alternative 1
Error16.2
Cost584
\[\begin{array}{l} \mathbf{if}\;x \leq -1.06 \cdot 10^{-34}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 7.2 \cdot 10^{+34}:\\ \;\;\;\;-4 \cdot \left(y \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 2
Error0.1
Cost448
\[x - \left(y \cdot 4\right) \cdot z \]
Alternative 3
Error27.2
Cost64
\[x \]

Error

Reproduce?

herbie shell --seed 2023088 
(FPCore (x y z)
  :name "Diagrams.Solve.Polynomial:quadForm from diagrams-solve-0.1, A"
  :precision binary64
  (- x (* (* y 4.0) z)))