| Alternative 1 | |
|---|---|
| Accuracy | 86.6% |
| Cost | 584 |
\[\begin{array}{l}
\mathbf{if}\;y \leq -1:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;y \leq 2.9 \cdot 10^{-167}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(x + 1\right)\\
\end{array}
\]
(FPCore (x y) :precision binary64 (+ (+ (* x y) x) y))
(FPCore (x y) :precision binary64 (+ x (fma x y y)))
double code(double x, double y) {
return ((x * y) + x) + y;
}
double code(double x, double y) {
return x + fma(x, y, y);
}
function code(x, y) return Float64(Float64(Float64(x * y) + x) + y) end
function code(x, y) return Float64(x + fma(x, y, y)) end
code[x_, y_] := N[(N[(N[(x * y), $MachinePrecision] + x), $MachinePrecision] + y), $MachinePrecision]
code[x_, y_] := N[(x + N[(x * y + y), $MachinePrecision]), $MachinePrecision]
\left(x \cdot y + x\right) + y
x + \mathsf{fma}\left(x, y, y\right)
Initial program 100.0%
Simplified100.0%
[Start]100.0 | \[ \left(x \cdot y + x\right) + y
\] |
|---|---|
+-commutative [=>]100.0 | \[ \color{blue}{\left(x + x \cdot y\right)} + y
\] |
associate-+l+ [=>]100.0 | \[ \color{blue}{x + \left(x \cdot y + y\right)}
\] |
fma-def [=>]100.0 | \[ x + \color{blue}{\mathsf{fma}\left(x, y, y\right)}
\] |
Final simplification100.0%
| Alternative 1 | |
|---|---|
| Accuracy | 86.6% |
| Cost | 584 |
| Alternative 2 | |
|---|---|
| Accuracy | 75.8% |
| Cost | 456 |
| Alternative 3 | |
|---|---|
| Accuracy | 86.9% |
| Cost | 452 |
| Alternative 4 | |
|---|---|
| Accuracy | 100.0% |
| Cost | 448 |
| Alternative 5 | |
|---|---|
| Accuracy | 72.5% |
| Cost | 196 |
| Alternative 6 | |
|---|---|
| Accuracy | 42.9% |
| Cost | 64 |
herbie shell --seed 2023147
(FPCore (x y)
:name "Numeric.Log:$cexpm1 from log-domain-0.10.2.1, B"
:precision binary64
(+ (+ (* x y) x) y))