\[\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 | 13248 |
|---|
\[\mathsf{fma}\left(z, t, \mathsf{fma}\left(x, y, a \cdot b\right)\right)
\]
| Alternative 2 |
|---|
| Error | 30.6 |
|---|
| Cost | 1492 |
|---|
\[\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -6.175360623142393 \cdot 10^{+37}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;a \cdot b \leq -2.1020288588462663 \cdot 10^{-11}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;a \cdot b \leq -9.504514635627273 \cdot 10^{-61}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;a \cdot b \leq -1.7157143268621938 \cdot 10^{-162}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;a \cdot b \leq 943691544.3511001:\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
\]
| Alternative 3 |
|---|
| Error | 9.9 |
|---|
| Cost | 1488 |
|---|
\[\begin{array}{l}
t_1 := x \cdot y + z \cdot t\\
t_2 := a \cdot b + z \cdot t\\
\mathbf{if}\;a \cdot b \leq -6.175360623142393 \cdot 10^{+37}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;a \cdot b \leq -2.1020288588462663 \cdot 10^{-11}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;a \cdot b \leq -4.4552928997820303 \cdot 10^{-72}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;a \cdot b \leq 943691544.3511001:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\]
| Alternative 4 |
|---|
| Error | 30.8 |
|---|
| Cost | 1232 |
|---|
\[\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -6.175360623142393 \cdot 10^{+37}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;a \cdot b \leq -2.1020288588462663 \cdot 10^{-11}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;a \cdot b \leq -4.4552928997820303 \cdot 10^{-72}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;a \cdot b \leq 943691544.3511001:\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
\]
| Alternative 5 |
|---|
| Error | 9.5 |
|---|
| Cost | 968 |
|---|
\[\begin{array}{l}
t_1 := a \cdot b + x \cdot y\\
\mathbf{if}\;a \cdot b \leq -6.175360623142393 \cdot 10^{+37}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;a \cdot b \leq 2.6038035406254634 \cdot 10^{-38}:\\
\;\;\;\;x \cdot y + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
| Alternative 6 |
|---|
| Error | 23.0 |
|---|
| Cost | 712 |
|---|
\[\begin{array}{l}
\mathbf{if}\;y \leq -1.1450364489305659 \cdot 10^{-118}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;y \leq 1.02 \cdot 10^{+117}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}
\]
| Alternative 7 |
|---|
| Error | 0.0 |
|---|
| Cost | 704 |
|---|
\[a \cdot b + \left(x \cdot y + z \cdot t\right)
\]
| Alternative 8 |
|---|
| Error | 41.5 |
|---|
| Cost | 192 |
|---|
\[x \cdot y
\]