\[\left(x \cdot y + z\right) \cdot y + t
\]
↓
\[\mathsf{fma}\left(\mathsf{fma}\left(x, y, z\right), y, t\right)
\]
(FPCore (x y z t) :precision binary64 (+ (* (+ (* x y) z) y) t))
↓
(FPCore (x y z t) :precision binary64 (fma (fma x y z) y t))
double code(double x, double y, double z, double t) {
return (((x * y) + z) * y) + t;
}
↓
double code(double x, double y, double z, double t) {
return fma(fma(x, y, z), y, t);
}
function code(x, y, z, t)
return Float64(Float64(Float64(Float64(x * y) + z) * y) + t)
end
↓
function code(x, y, z, t)
return fma(fma(x, y, z), y, t)
end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x * y), $MachinePrecision] + z), $MachinePrecision] * y), $MachinePrecision] + t), $MachinePrecision]
↓
code[x_, y_, z_, t_] := N[(N[(x * y + z), $MachinePrecision] * y + t), $MachinePrecision]
\left(x \cdot y + z\right) \cdot y + t
↓
\mathsf{fma}\left(\mathsf{fma}\left(x, y, z\right), y, t\right)
Alternatives
| Alternative 1 |
|---|
| Error | 11.0 |
|---|
| Cost | 1108 |
|---|
\[\begin{array}{l}
t_1 := t + y \cdot z\\
t_2 := y \cdot \left(z + x \cdot y\right)\\
\mathbf{if}\;y \leq -2.6 \cdot 10^{+57}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y \leq -3.4 \cdot 10^{-6}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -1.5 \cdot 10^{-21}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y \leq -6.2 \cdot 10^{-159}:\\
\;\;\;\;t + x \cdot \left(y \cdot y\right)\\
\mathbf{elif}\;y \leq 3.2 \cdot 10^{+56}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\]
| Alternative 2 |
|---|
| Error | 27.2 |
|---|
| Cost | 984 |
|---|
\[\begin{array}{l}
\mathbf{if}\;z \leq -2.7 \cdot 10^{+109}:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;z \leq -5 \cdot 10^{-161}:\\
\;\;\;\;t\\
\mathbf{elif}\;z \leq -2.95 \cdot 10^{-217}:\\
\;\;\;\;y \cdot \left(x \cdot y\right)\\
\mathbf{elif}\;z \leq 4.8 \cdot 10^{+16}:\\
\;\;\;\;t\\
\mathbf{elif}\;z \leq 3.1 \cdot 10^{+59}:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;z \leq 4.4 \cdot 10^{+145}:\\
\;\;\;\;t\\
\mathbf{else}:\\
\;\;\;\;y \cdot z\\
\end{array}
\]
| Alternative 3 |
|---|
| Error | 26.0 |
|---|
| Cost | 720 |
|---|
\[\begin{array}{l}
\mathbf{if}\;z \leq -1.15 \cdot 10^{+109}:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;z \leq 34500000000000:\\
\;\;\;\;t\\
\mathbf{elif}\;z \leq 1.9 \cdot 10^{+60}:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;z \leq 1.05 \cdot 10^{+144}:\\
\;\;\;\;t\\
\mathbf{else}:\\
\;\;\;\;y \cdot z\\
\end{array}
\]
| Alternative 4 |
|---|
| Error | 9.5 |
|---|
| Cost | 713 |
|---|
\[\begin{array}{l}
\mathbf{if}\;y \leq -3.5 \cdot 10^{+57} \lor \neg \left(y \leq 2.9 \cdot 10^{+56}\right):\\
\;\;\;\;y \cdot \left(z + x \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;t + y \cdot z\\
\end{array}
\]
| Alternative 5 |
|---|
| Error | 4.9 |
|---|
| Cost | 713 |
|---|
\[\begin{array}{l}
\mathbf{if}\;z \leq -380000 \lor \neg \left(z \leq 0.235\right):\\
\;\;\;\;t + y \cdot z\\
\mathbf{else}:\\
\;\;\;\;t + y \cdot \left(x \cdot y\right)\\
\end{array}
\]
| Alternative 6 |
|---|
| Error | 14.4 |
|---|
| Cost | 585 |
|---|
\[\begin{array}{l}
\mathbf{if}\;z \leq -4.8 \cdot 10^{-161} \lor \neg \left(z \leq -2.95 \cdot 10^{-217}\right):\\
\;\;\;\;t + y \cdot z\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(x \cdot y\right)\\
\end{array}
\]
| Alternative 7 |
|---|
| Error | 0.1 |
|---|
| Cost | 576 |
|---|
\[t + y \cdot \left(z + x \cdot y\right)
\]
| Alternative 8 |
|---|
| Error | 28.9 |
|---|
| Cost | 64 |
|---|
\[t
\]