\[\left(x \cdot y + z \cdot t\right) + a \cdot b
\]
↓
\[\mathsf{fma}\left(x, y, \mathsf{fma}\left(a, b, z \cdot t\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 a b (* z t))))
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(a, b, (z * t)));
}
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(a, b, Float64(z * t)))
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[(a * b + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(x \cdot y + z \cdot t\right) + a \cdot b
↓
\mathsf{fma}\left(x, y, \mathsf{fma}\left(a, b, z \cdot t\right)\right)
Alternatives
| Alternative 1 |
|---|
| Error | 0.0 |
|---|
| Cost | 6976 |
|---|
\[\mathsf{fma}\left(x, y, z \cdot t\right) + a \cdot b
\]
| Alternative 2 |
|---|
| Error | 22.8 |
|---|
| Cost | 1372 |
|---|
\[\begin{array}{l}
t_1 := a \cdot b + z \cdot t\\
\mathbf{if}\;y \leq -6.8 \cdot 10^{-101}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;y \leq 1.5 \cdot 10^{+118}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 1.9 \cdot 10^{+132}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;y \leq 2.2 \cdot 10^{+178}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 3.25 \cdot 10^{+236}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;y \leq 1.8 \cdot 10^{+246}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 5.6 \cdot 10^{+265}:\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
| Alternative 3 |
|---|
| Error | 30.5 |
|---|
| Cost | 972 |
|---|
\[\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -1.85 \cdot 10^{-81}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;a \cdot b \leq -1.02 \cdot 10^{-171}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;a \cdot b \leq 4.3 \cdot 10^{+16}:\\
\;\;\;\;z \cdot t\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
\]
| Alternative 4 |
|---|
| Error | 9.8 |
|---|
| Cost | 968 |
|---|
\[\begin{array}{l}
t_1 := a \cdot b + x \cdot y\\
\mathbf{if}\;a \cdot b \leq -1.85 \cdot 10^{-81}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;a \cdot b \leq 1.36 \cdot 10^{+32}:\\
\;\;\;\;x \cdot y + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
| Alternative 5 |
|---|
| Error | 30.8 |
|---|
| Cost | 712 |
|---|
\[\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -9 \cdot 10^{-104}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;a \cdot b \leq 1.28 \cdot 10^{+20}:\\
\;\;\;\;z \cdot t\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
\]
| Alternative 6 |
|---|
| Error | 13.9 |
|---|
| Cost | 712 |
|---|
\[\begin{array}{l}
t_1 := a \cdot b + x \cdot y\\
\mathbf{if}\;y \leq -6.5 \cdot 10^{-101}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 10:\\
\;\;\;\;a \cdot b + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
| Alternative 7 |
|---|
| Error | 0.0 |
|---|
| Cost | 704 |
|---|
\[a \cdot b + \left(x \cdot y + z \cdot t\right)
\]
| Alternative 8 |
|---|
| Error | 41.4 |
|---|
| Cost | 192 |
|---|
\[a \cdot b
\]