\[\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.07% |
|---|
| Cost | 1492 |
|---|
\[\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -3.05 \cdot 10^{+88}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;a \cdot b \leq -2.3 \cdot 10^{-77}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;a \cdot b \leq 5.6 \cdot 10^{-275}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;a \cdot b \leq 1.1 \cdot 10^{-219}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;a \cdot b \leq 5.8 \cdot 10^{+93}:\\
\;\;\;\;z \cdot t\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
\]
| Alternative 2 |
|---|
| Error | 15.57% |
|---|
| 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.35 \cdot 10^{+48}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;a \cdot b \leq 2.9 \cdot 10^{-67}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;a \cdot b \leq 1.55 \cdot 10^{+49}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\mathbf{elif}\;a \cdot b \leq 1.4 \cdot 10^{+89}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\]
| Alternative 3 |
|---|
| Error | 32.2% |
|---|
| Cost | 977 |
|---|
\[\begin{array}{l}
\mathbf{if}\;y \leq -6.2 \cdot 10^{-19}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;y \leq 380000000 \lor \neg \left(y \leq 1.12 \cdot 10^{+27}\right) \land y \leq 4.6 \cdot 10^{+149}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}
\]
| Alternative 4 |
|---|
| Error | 22.11% |
|---|
| Cost | 713 |
|---|
\[\begin{array}{l}
\mathbf{if}\;t \leq -3.6 \cdot 10^{-111} \lor \neg \left(t \leq 7500000\right):\\
\;\;\;\;a \cdot b + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + x \cdot y\\
\end{array}
\]
| Alternative 5 |
|---|
| Error | 47.53% |
|---|
| Cost | 712 |
|---|
\[\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -2.2 \cdot 10^{+47}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;a \cdot b \leq 1.05 \cdot 10^{+94}:\\
\;\;\;\;z \cdot t\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
\]
| Alternative 6 |
|---|
| Error | 0.03% |
|---|
| Cost | 704 |
|---|
\[a \cdot b + \left(x \cdot y + z \cdot t\right)
\]
| Alternative 7 |
|---|
| Error | 64.75% |
|---|
| Cost | 192 |
|---|
\[a \cdot b
\]