| Alternative 1 | |
|---|---|
| Accuracy | 81.1% |
| Cost | 585 |
\[\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}
\]
(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)
Results
Initial program 100.0%
Taylor expanded in x around -inf 100.0%
Simplified100.0%
[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)
\] |
Final simplification100.0%
| Alternative 1 | |
|---|---|
| Accuracy | 81.1% |
| Cost | 585 |
| Alternative 2 | |
|---|---|
| Accuracy | 79.4% |
| Cost | 585 |
| Alternative 3 | |
|---|---|
| Accuracy | 61.9% |
| Cost | 456 |
| Alternative 4 | |
|---|---|
| Accuracy | 61.5% |
| Cost | 456 |
| Alternative 5 | |
|---|---|
| Accuracy | 100.0% |
| Cost | 448 |
| Alternative 6 | |
|---|---|
| Accuracy | 45.5% |
| Cost | 64 |
herbie shell --seed 2023138
(FPCore (x y z)
:name "Main:bigenough2 from A"
:precision binary64
(+ x (* y (+ z x))))