| Alternative 1 | |
|---|---|
| Accuracy | 100.0% |
| Cost | 6976 |
\[a \cdot b + \mathsf{fma}\left(x, y, z \cdot t\right)
\]
(FPCore (x y z t a b) :precision binary64 (+ (+ (* x y) (* z t)) (* a b)))
(FPCore (x y z t a b) :precision binary64 (fma x y (fma z t (* a b))))
double code(double x, double y, double z, double t, double a, double b) {
return ((x * y) + (z * t)) + (a * b);
}
double code(double x, double y, double z, double t, double a, double b) {
return fma(x, y, fma(z, t, (a * b)));
}
function code(x, y, z, t, a, b) return Float64(Float64(Float64(x * y) + Float64(z * t)) + Float64(a * b)) end
function code(x, y, z, t, a, b) return fma(x, y, fma(z, t, Float64(a * b))) end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_, a_, b_] := N[(x * y + N[(z * t + N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(x \cdot y + z \cdot t\right) + a \cdot b
\mathsf{fma}\left(x, y, \mathsf{fma}\left(z, t, a \cdot b\right)\right)
Initial program 100.0%
Simplified100.0%
[Start]100.0 | \[ \left(x \cdot y + z \cdot t\right) + a \cdot b
\] |
|---|---|
associate-+l+ [=>]100.0 | \[ \color{blue}{x \cdot y + \left(z \cdot t + a \cdot b\right)}
\] |
fma-def [=>]100.0 | \[ \color{blue}{\mathsf{fma}\left(x, y, z \cdot t + a \cdot b\right)}
\] |
fma-def [=>]100.0 | \[ \mathsf{fma}\left(x, y, \color{blue}{\mathsf{fma}\left(z, t, a \cdot b\right)}\right)
\] |
Final simplification100.0%
| Alternative 1 | |
|---|---|
| Accuracy | 100.0% |
| Cost | 6976 |
| Alternative 2 | |
|---|---|
| Accuracy | 52.2% |
| Cost | 2012 |
| Alternative 3 | |
|---|---|
| Accuracy | 76.0% |
| Cost | 1243 |
| Alternative 4 | |
|---|---|
| Accuracy | 84.7% |
| Cost | 969 |
| Alternative 5 | |
|---|---|
| Accuracy | 52.5% |
| Cost | 712 |
| Alternative 6 | |
|---|---|
| Accuracy | 63.9% |
| Cost | 712 |
| Alternative 7 | |
|---|---|
| Accuracy | 100.0% |
| Cost | 704 |
| Alternative 8 | |
|---|---|
| Accuracy | 34.6% |
| Cost | 192 |
herbie shell --seed 2023137
(FPCore (x y z t a b)
:name "Linear.V3:$cdot from linear-1.19.1.3, B"
:precision binary64
(+ (+ (* x y) (* z t)) (* a b)))