\[\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 | 43.48% |
|---|
| Cost | 1244 |
|---|
\[\begin{array}{l}
t_1 := y \cdot \left(x \cdot y\right)\\
\mathbf{if}\;y \leq -9.8 \cdot 10^{+61}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -6.8 \cdot 10^{-16}:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;y \leq -3.8 \cdot 10^{-43}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq -1.55 \cdot 10^{-72}:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;y \leq -1.4 \cdot 10^{-208}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq -7.6 \cdot 10^{-242}:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;y \leq 1.05 \cdot 10^{-17}:\\
\;\;\;\;t\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
| Alternative 2 |
|---|
| Error | 18.5% |
|---|
| Cost | 1241 |
|---|
\[\begin{array}{l}
t_1 := t + y \cdot z\\
t_2 := t + x \cdot \left(y \cdot y\right)\\
\mathbf{if}\;t \leq -1.05 \cdot 10^{+29}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq -3.1 \cdot 10^{-79}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t \leq -7.2 \cdot 10^{-172}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 2 \cdot 10^{-162}:\\
\;\;\;\;y \cdot \left(z + x \cdot y\right)\\
\mathbf{elif}\;t \leq 9.5 \cdot 10^{-7} \lor \neg \left(t \leq 1.3 \cdot 10^{+89}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\]
| Alternative 3 |
|---|
| Error | 39.64% |
|---|
| Cost | 720 |
|---|
\[\begin{array}{l}
\mathbf{if}\;t \leq -9.2 \cdot 10^{-80}:\\
\;\;\;\;t\\
\mathbf{elif}\;t \leq 1.2 \cdot 10^{-165}:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;t \leq 7 \cdot 10^{-139}:\\
\;\;\;\;t\\
\mathbf{elif}\;t \leq 4.6 \cdot 10^{-52}:\\
\;\;\;\;y \cdot z\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\]
| Alternative 4 |
|---|
| Error | 15.03% |
|---|
| Cost | 713 |
|---|
\[\begin{array}{l}
\mathbf{if}\;y \leq -7.5 \cdot 10^{-9} \lor \neg \left(y \leq 6.6 \cdot 10^{-22}\right):\\
\;\;\;\;y \cdot \left(z + x \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;t + y \cdot z\\
\end{array}
\]
| Alternative 5 |
|---|
| Error | 22.72% |
|---|
| Cost | 585 |
|---|
\[\begin{array}{l}
\mathbf{if}\;y \leq -3.4 \cdot 10^{+67} \lor \neg \left(y \leq 1.75 \cdot 10^{-17}\right):\\
\;\;\;\;y \cdot \left(x \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;t + y \cdot z\\
\end{array}
\]
| Alternative 6 |
|---|
| Error | 0.1% |
|---|
| Cost | 576 |
|---|
\[t + y \cdot \left(z + x \cdot y\right)
\]
| Alternative 7 |
|---|
| Error | 46.49% |
|---|
| Cost | 64 |
|---|
\[t
\]