?

Average Accuracy: 100.0% → 100.0%
Time: 3.3s
Precision: binary64
Cost: 576

?

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

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Initial program 100.0%

    \[x + y \cdot \left(z + x\right) \]
  2. Taylor expanded in x around -inf 100.0%

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

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

    [Start]100.0

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

    mul-1-neg [=>]100.0

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

    unsub-neg [=>]100.0

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

    *-commutative [=>]100.0

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

    mul-1-neg [=>]100.0

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

    sub-neg [=>]100.0

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

    metadata-eval [=>]100.0

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

    +-commutative [=>]100.0

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

    neg-sub0 [=>]100.0

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

    associate-+r- [=>]100.0

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

    metadata-eval [=>]100.0

    \[ y \cdot z - x \cdot \left(\color{blue}{-1} - y\right) \]
  4. Final simplification100.0%

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

Alternatives

Alternative 1
Accuracy81.1%
Cost585
\[\begin{array}{l} \mathbf{if}\;y \leq -7 \cdot 10^{-8} \lor \neg \left(y \leq 9.2 \cdot 10^{-45}\right):\\ \;\;\;\;y \cdot \left(z + x\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 2
Accuracy79.4%
Cost585
\[\begin{array}{l} \mathbf{if}\;x \leq -1.05 \cdot 10^{-9} \lor \neg \left(x \leq 2.2 \cdot 10^{-57}\right):\\ \;\;\;\;x \cdot \left(y + 1\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(z + x\right)\\ \end{array} \]
Alternative 3
Accuracy61.9%
Cost456
\[\begin{array}{l} \mathbf{if}\;y \leq -4.2 \cdot 10^{-7}:\\ \;\;\;\;y \cdot x\\ \mathbf{elif}\;y \leq 1:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;y \cdot x\\ \end{array} \]
Alternative 4
Accuracy61.5%
Cost456
\[\begin{array}{l} \mathbf{if}\;x \leq -2.3 \cdot 10^{-9}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 5.7 \cdot 10^{-64}:\\ \;\;\;\;y \cdot z\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 5
Accuracy100.0%
Cost448
\[x + y \cdot \left(z + x\right) \]
Alternative 6
Accuracy45.5%
Cost64
\[x \]

Error

Reproduce?

herbie shell --seed 2023138 
(FPCore (x y z)
  :name "Main:bigenough2 from A"
  :precision binary64
  (+ x (* y (+ z x))))