\[\left(x \cdot y + z \cdot t\right) + a \cdot b
\]
↓
\[\mathsf{fma}\left(b, a, z \cdot t + x \cdot y\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 b a (+ (* z t) (* x y))))
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(b, a, ((z * t) + (x * y)));
}
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(b, a, Float64(Float64(z * t) + Float64(x * y)))
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[(b * a + N[(N[(z * t), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(x \cdot y + z \cdot t\right) + a \cdot b
↓
\mathsf{fma}\left(b, a, z \cdot t + x \cdot y\right)
Alternatives
| Alternative 1 |
|---|
| Error | 30.1 |
|---|
| Cost | 2272 |
|---|
\[\begin{array}{l}
\mathbf{if}\;b \cdot a \leq -7.5 \cdot 10^{-5}:\\
\;\;\;\;b \cdot a\\
\mathbf{elif}\;b \cdot a \leq -4.3 \cdot 10^{-301}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;b \cdot a \leq 2.3 \cdot 10^{-248}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;b \cdot a \leq 1.55 \cdot 10^{-167}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;b \cdot a \leq 4.6 \cdot 10^{-119}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;b \cdot a \leq 1.28 \cdot 10^{-111}:\\
\;\;\;\;b \cdot a\\
\mathbf{elif}\;b \cdot a \leq 3.2 \cdot 10^{-25}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;b \cdot a \leq 2.2:\\
\;\;\;\;z \cdot t\\
\mathbf{else}:\\
\;\;\;\;b \cdot a\\
\end{array}
\]
| Alternative 2 |
|---|
| Error | 21.0 |
|---|
| Cost | 977 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq -6.4 \cdot 10^{+175}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;x \leq -5.8 \cdot 10^{+44} \lor \neg \left(x \leq -8 \cdot 10^{-16}\right) \land x \leq 10^{-20}:\\
\;\;\;\;b \cdot a + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}
\]
| Alternative 3 |
|---|
| Error | 14.9 |
|---|
| Cost | 713 |
|---|
\[\begin{array}{l}
\mathbf{if}\;t \leq -8.2 \cdot 10^{-133} \lor \neg \left(t \leq 5 \cdot 10^{+52}\right):\\
\;\;\;\;b \cdot a + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;b \cdot a + x \cdot y\\
\end{array}
\]
| Alternative 4 |
|---|
| Error | 30.0 |
|---|
| Cost | 712 |
|---|
\[\begin{array}{l}
\mathbf{if}\;b \cdot a \leq -1.38 \cdot 10^{-42}:\\
\;\;\;\;b \cdot a\\
\mathbf{elif}\;b \cdot a \leq 2.5:\\
\;\;\;\;z \cdot t\\
\mathbf{else}:\\
\;\;\;\;b \cdot a\\
\end{array}
\]
| Alternative 5 |
|---|
| Error | 0.0 |
|---|
| Cost | 704 |
|---|
\[\left(z \cdot t + x \cdot y\right) + b \cdot a
\]
| Alternative 6 |
|---|
| Error | 41.9 |
|---|
| Cost | 192 |
|---|
\[b \cdot a
\]