\[\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 |
|---|
| Error | 30.3 |
|---|
| Cost | 2272 |
|---|
\[\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -6.5 \cdot 10^{+20}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;a \cdot b \leq -4.2 \cdot 10^{-102}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;a \cdot b \leq -1.5 \cdot 10^{-125}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;a \cdot b \leq -2.9 \cdot 10^{-160}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;a \cdot b \leq -1.3 \cdot 10^{-281}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;a \cdot b \leq 1.18 \cdot 10^{-118}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;a \cdot b \leq 4.9 \cdot 10^{-73}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;a \cdot b \leq 3.1 \cdot 10^{+28}:\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
\]
| Alternative 2 |
|---|
| Error | 9.8 |
|---|
| Cost | 1488 |
|---|
\[\begin{array}{l}
t_1 := x \cdot y + z \cdot t\\
t_2 := a \cdot b + x \cdot y\\
\mathbf{if}\;a \cdot b \leq -2.9 \cdot 10^{+21}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;a \cdot b \leq 8 \cdot 10^{-129}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;a \cdot b \leq 5.4 \cdot 10^{-72}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\mathbf{elif}\;a \cdot b \leq 1.24 \cdot 10^{-17}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\]
| Alternative 3 |
|---|
| Error | 23.1 |
|---|
| Cost | 1243 |
|---|
\[\begin{array}{l}
\mathbf{if}\;y \leq -5.5 \cdot 10^{-122} \lor \neg \left(y \leq 2.2 \cdot 10^{+32}\right) \land \left(y \leq 1.22 \cdot 10^{+39} \lor \neg \left(y \leq 8 \cdot 10^{+120}\right) \land \left(y \leq 5.6 \cdot 10^{+151} \lor \neg \left(y \leq 2.02 \cdot 10^{+214}\right)\right)\right):\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\end{array}
\]
| Alternative 4 |
|---|
| Error | 30.0 |
|---|
| Cost | 1233 |
|---|
\[\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -3.3 \cdot 10^{+21}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;a \cdot b \leq 1.18 \cdot 10^{-118} \lor \neg \left(a \cdot b \leq 4 \cdot 10^{-78}\right) \land a \cdot b \leq 3.55 \cdot 10^{-16}:\\
\;\;\;\;z \cdot t\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
\]
| Alternative 5 |
|---|
| Error | 13.6 |
|---|
| Cost | 978 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq -9500000000000 \lor \neg \left(x \leq -2.8 \cdot 10^{-17} \lor \neg \left(x \leq -6 \cdot 10^{-48}\right) \land x \leq 2.7 \cdot 10^{-52}\right):\\
\;\;\;\;a \cdot b + x \cdot y\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\end{array}
\]
| Alternative 6 |
|---|
| Error | 0.0 |
|---|
| Cost | 704 |
|---|
\[a \cdot b + \left(x \cdot y + z \cdot t\right)
\]
| Alternative 7 |
|---|
| Error | 41.4 |
|---|
| Cost | 192 |
|---|
\[a \cdot b
\]