\[\left(x \cdot y + z \cdot t\right) + a \cdot b
\]
↓
\[\mathsf{fma}\left(x, y, z \cdot t\right) + a \cdot b
\]
(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 (* 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, (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 Float64(fma(x, y, Float64(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[(N[(x * y + N[(z * t), $MachinePrecision]), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision]
\left(x \cdot y + z \cdot t\right) + a \cdot b
↓
\mathsf{fma}\left(x, y, z \cdot t\right) + a \cdot b
Alternatives
| Alternative 1 |
|---|
| Accuracy | 28.8% |
|---|
| Cost | 1515 |
|---|
\[\begin{array}{l}
\mathbf{if}\;t \leq -6 \cdot 10^{-81}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;t \leq -9.6 \cdot 10^{-215}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;t \leq 1.18 \cdot 10^{-231}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;t \leq 1.5 \cdot 10^{-176}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;t \leq 4 \cdot 10^{-120} \lor \neg \left(t \leq 1.9 \cdot 10^{-102}\right) \land \left(t \leq 1.05 \cdot 10^{-55} \lor \neg \left(t \leq 5.6 \cdot 10^{+59}\right) \land \left(t \leq 8 \cdot 10^{+174} \lor \neg \left(t \leq 8.6 \cdot 10^{+199}\right)\right)\right):\\
\;\;\;\;z \cdot t\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
\]
| Alternative 2 |
|---|
| Accuracy | 46.4% |
|---|
| Cost | 977 |
|---|
\[\begin{array}{l}
\mathbf{if}\;y \leq -3.7 \cdot 10^{-117}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;y \leq 2.15 \cdot 10^{+18} \lor \neg \left(y \leq 4.2 \cdot 10^{+117}\right) \land y \leq 1.35 \cdot 10^{+167}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + x \cdot y\\
\end{array}
\]
| Alternative 3 |
|---|
| Accuracy | 51.6% |
|---|
| Cost | 977 |
|---|
\[\begin{array}{l}
\mathbf{if}\;y \leq -8.6 \cdot 10^{-180}:\\
\;\;\;\;x \cdot y + z \cdot t\\
\mathbf{elif}\;y \leq 1.75 \cdot 10^{+18} \lor \neg \left(y \leq 4.4 \cdot 10^{+117}\right) \land y \leq 1.3 \cdot 10^{+167}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + x \cdot y\\
\end{array}
\]
| Alternative 4 |
|---|
| Accuracy | 35.4% |
|---|
| Cost | 712 |
|---|
\[\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -2.1 \cdot 10^{+46}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;a \cdot b \leq 1.6 \cdot 10^{-63}:\\
\;\;\;\;z \cdot t\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
\]
| Alternative 5 |
|---|
| Accuracy | 44.1% |
|---|
| Cost | 712 |
|---|
\[\begin{array}{l}
\mathbf{if}\;y \leq -3.7 \cdot 10^{-117}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;y \leq 2.8 \cdot 10^{+171}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}
\]
| Alternative 6 |
|---|
| Accuracy | 68.0% |
|---|
| Cost | 704 |
|---|
\[a \cdot b + \left(x \cdot y + z \cdot t\right)
\]
| Alternative 7 |
|---|
| Accuracy | 23.7% |
|---|
| Cost | 192 |
|---|
\[a \cdot b
\]