| Alternative 1 | |
|---|---|
| Accuracy | 58.5% |
| Cost | 7232 |
\[\mathsf{fma}\left(x, y, z \cdot t\right) + \left(a \cdot b + c \cdot i\right)
\]
(FPCore (x y z t a b c i) :precision binary64 (+ (+ (+ (* x y) (* z t)) (* a b)) (* c i)))
(FPCore (x y z t a b c i) :precision binary64 (fma c i (fma x y (fma z t (* a b)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return (((x * y) + (z * t)) + (a * b)) + (c * i);
}
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return fma(c, i, fma(x, y, fma(z, t, (a * b))));
}
function code(x, y, z, t, a, b, c, i) return Float64(Float64(Float64(Float64(x * y) + Float64(z * t)) + Float64(a * b)) + Float64(c * i)) end
function code(x, y, z, t, a, b, c, i) return fma(c, i, fma(x, y, fma(z, t, Float64(a * b)))) end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(c * i + N[(x * y + N[(z * t + N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i
\mathsf{fma}\left(c, i, \mathsf{fma}\left(x, y, \mathsf{fma}\left(z, t, a \cdot b\right)\right)\right)
Initial program 59.7%
Simplified59.7%
[Start]59.7 | \[ \left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i
\] |
|---|---|
+-commutative [=>]59.7 | \[ \color{blue}{c \cdot i + \left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right)}
\] |
fma-def [=>]59.7 | \[ \color{blue}{\mathsf{fma}\left(c, i, \left(x \cdot y + z \cdot t\right) + a \cdot b\right)}
\] |
associate-+l+ [=>]59.7 | \[ \mathsf{fma}\left(c, i, \color{blue}{x \cdot y + \left(z \cdot t + a \cdot b\right)}\right)
\] |
fma-def [=>]59.7 | \[ \mathsf{fma}\left(c, i, \color{blue}{\mathsf{fma}\left(x, y, z \cdot t + a \cdot b\right)}\right)
\] |
fma-def [=>]59.7 | \[ \mathsf{fma}\left(c, i, \mathsf{fma}\left(x, y, \color{blue}{\mathsf{fma}\left(z, t, a \cdot b\right)}\right)\right)
\] |
Final simplification59.7%
| Alternative 1 | |
|---|---|
| Accuracy | 58.5% |
| Cost | 7232 |
| Alternative 2 | |
|---|---|
| Accuracy | 24.4% |
| Cost | 1492 |
| Alternative 3 | |
|---|---|
| Accuracy | 36.9% |
| Cost | 1488 |
| Alternative 4 | |
|---|---|
| Accuracy | 38.4% |
| Cost | 1488 |
| Alternative 5 | |
|---|---|
| Accuracy | 38.9% |
| Cost | 1488 |
| Alternative 6 | |
|---|---|
| Accuracy | 51.1% |
| Cost | 1224 |
| Alternative 7 | |
|---|---|
| Accuracy | 52.2% |
| Cost | 1224 |
| Alternative 8 | |
|---|---|
| Accuracy | 53.3% |
| Cost | 1224 |
| Alternative 9 | |
|---|---|
| Accuracy | 20.3% |
| Cost | 984 |
| Alternative 10 | |
|---|---|
| Accuracy | 37.1% |
| Cost | 968 |
| Alternative 11 | |
|---|---|
| Accuracy | 58.5% |
| Cost | 960 |
| Alternative 12 | |
|---|---|
| Accuracy | 24.8% |
| Cost | 712 |
| Alternative 13 | |
|---|---|
| Accuracy | 15.8% |
| Cost | 192 |
herbie shell --seed 2023157
(FPCore (x y z t a b c i)
:name "Linear.V4:$cdot from linear-1.19.1.3, C"
:precision binary64
(+ (+ (+ (* x y) (* z t)) (* a b)) (* c i)))