\[\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)
\]
(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)
Alternatives
| Alternative 1 |
|---|
| Accuracy | 52.4% |
|---|
| Cost | 2532 |
|---|
\[\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -7.5 \cdot 10^{+86}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;a \cdot b \leq -6.4 \cdot 10^{-307}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;a \cdot b \leq 1.95 \cdot 10^{-238}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;a \cdot b \leq 2.6 \cdot 10^{-183}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;a \cdot b \leq 1.55 \cdot 10^{-62}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;a \cdot b \leq 3.7 \cdot 10^{+14}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;a \cdot b \leq 9.2 \cdot 10^{+25}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;a \cdot b \leq 1.8 \cdot 10^{+37}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;a \cdot b \leq 2.1 \cdot 10^{+39}:\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
\]
| Alternative 2 |
|---|
| Accuracy | 76.3% |
|---|
| Cost | 1243 |
|---|
\[\begin{array}{l}
\mathbf{if}\;z \leq -8.5 \cdot 10^{+140} \lor \neg \left(z \leq -3.3 \cdot 10^{+97}\right) \land \left(z \leq -8.5 \cdot 10^{+22} \lor \neg \left(z \leq -5 \cdot 10^{-67}\right) \land \left(z \leq -1.6 \cdot 10^{-89} \lor \neg \left(z \leq 4.1 \cdot 10^{-126}\right)\right)\right):\\
\;\;\;\;a \cdot b + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + x \cdot y\\
\end{array}
\]
| Alternative 3 |
|---|
| Accuracy | 67.9% |
|---|
| Cost | 977 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq -2.1 \cdot 10^{+134}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;x \leq -6.5 \cdot 10^{+89} \lor \neg \left(x \leq -2.5 \cdot 10^{+77}\right) \land x \leq 7.8 \cdot 10^{-24}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}
\]
| Alternative 4 |
|---|
| Accuracy | 84.8% |
|---|
| Cost | 969 |
|---|
\[\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -8.2 \cdot 10^{+86} \lor \neg \left(a \cdot b \leq 1.85 \cdot 10^{+39}\right):\\
\;\;\;\;a \cdot b + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;z \cdot t + x \cdot y\\
\end{array}
\]
| Alternative 5 |
|---|
| Accuracy | 52.5% |
|---|
| Cost | 712 |
|---|
\[\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -4.7 \cdot 10^{+86}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;a \cdot b \leq 10^{+26}:\\
\;\;\;\;z \cdot t\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
\]
| Alternative 6 |
|---|
| Accuracy | 100.0% |
|---|
| Cost | 704 |
|---|
\[a \cdot b + \left(z \cdot t + x \cdot y\right)
\]
| Alternative 7 |
|---|
| Accuracy | 34.3% |
|---|
| Cost | 192 |
|---|
\[a \cdot b
\]