\[\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 |
|---|
| Error | 49.11% |
|---|
| Cost | 3053 |
|---|
\[\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -5.2 \cdot 10^{+75}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;a \cdot b \leq -4.8 \cdot 10^{+29}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;a \cdot b \leq -3.2 \cdot 10^{-104}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;a \cdot b \leq -3.5 \cdot 10^{-178}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;a \cdot b \leq 1.65 \cdot 10^{-307}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;a \cdot b \leq 9.2 \cdot 10^{-219}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;a \cdot b \leq 2 \cdot 10^{-167}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;a \cdot b \leq 3.2 \cdot 10^{-69}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;a \cdot b \leq 8 \cdot 10^{-33} \lor \neg \left(a \cdot b \leq 1.55 \cdot 10^{+98}\right) \land a \cdot b \leq 8.5 \cdot 10^{+172}:\\
\;\;\;\;z \cdot t\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
\]
| Alternative 2 |
|---|
| Error | 15.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 -5.2 \cdot 10^{+75}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;a \cdot b \leq -4.8 \cdot 10^{-49}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;a \cdot b \leq -4 \cdot 10^{-120}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;a \cdot b \leq 1.3 \cdot 10^{+23}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\end{array}
\]
| Alternative 3 |
|---|
| Error | 48.45% |
|---|
| Cost | 1233 |
|---|
\[\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -1.25 \cdot 10^{-18}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;a \cdot b \leq 1.05 \cdot 10^{-32} \lor \neg \left(a \cdot b \leq 2.35 \cdot 10^{+98}\right) \land a \cdot b \leq 8.5 \cdot 10^{+172}:\\
\;\;\;\;z \cdot t\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
\]
| Alternative 4 |
|---|
| Error | 25.13% |
|---|
| Cost | 713 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq -3.6 \cdot 10^{+102} \lor \neg \left(x \leq 3.8 \cdot 10^{-154}\right):\\
\;\;\;\;a \cdot b + x \cdot y\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\end{array}
\]
| Alternative 5 |
|---|
| Error | 34.96% |
|---|
| Cost | 712 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq -1.1 \cdot 10^{+146}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;x \leq 1.2 \cdot 10^{-96}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}
\]
| Alternative 6 |
|---|
| Error | 0.03% |
|---|
| Cost | 704 |
|---|
\[a \cdot b + \left(x \cdot y + z \cdot t\right)
\]
| Alternative 7 |
|---|
| Error | 65.42% |
|---|
| Cost | 192 |
|---|
\[a \cdot b
\]