\[\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 | 19.09% |
|---|
| Cost | 1110 |
|---|
\[\begin{array}{l}
\mathbf{if}\;y \leq -1.3 \cdot 10^{+110}:\\
\;\;\;\;y \cdot \left(z + x \cdot y\right)\\
\mathbf{elif}\;y \leq -9.6 \cdot 10^{+41} \lor \neg \left(y \leq -2300 \lor \neg \left(y \leq 7 \cdot 10^{-122}\right) \land y \leq 7.8 \cdot 10^{+96}\right):\\
\;\;\;\;t + y \cdot z\\
\mathbf{else}:\\
\;\;\;\;t + x \cdot \left(y \cdot y\right)\\
\end{array}
\]
| Alternative 2 |
|---|
| Error | 41.91% |
|---|
| Cost | 984 |
|---|
\[\begin{array}{l}
\mathbf{if}\;z \leq -2.1 \cdot 10^{+227}:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;z \leq -1.7 \cdot 10^{+214}:\\
\;\;\;\;t\\
\mathbf{elif}\;z \leq -2 \cdot 10^{+82}:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;z \leq 9.4 \cdot 10^{-296}:\\
\;\;\;\;t\\
\mathbf{elif}\;z \leq 1.65 \cdot 10^{-277}:\\
\;\;\;\;y \cdot \left(x \cdot y\right)\\
\mathbf{elif}\;z \leq 5.6 \cdot 10^{+65}:\\
\;\;\;\;t\\
\mathbf{else}:\\
\;\;\;\;y \cdot z\\
\end{array}
\]
| Alternative 3 |
|---|
| Error | 41.3% |
|---|
| Cost | 720 |
|---|
\[\begin{array}{l}
\mathbf{if}\;z \leq -2.1 \cdot 10^{+227}:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;z \leq -1.7 \cdot 10^{+214}:\\
\;\;\;\;t\\
\mathbf{elif}\;z \leq -1.2 \cdot 10^{+83}:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;z \leq 3.9 \cdot 10^{+65}:\\
\;\;\;\;t\\
\mathbf{else}:\\
\;\;\;\;y \cdot z\\
\end{array}
\]
| Alternative 4 |
|---|
| Error | 18.01% |
|---|
| Cost | 713 |
|---|
\[\begin{array}{l}
\mathbf{if}\;t \leq -6.4 \cdot 10^{-204} \lor \neg \left(t \leq 2.45 \cdot 10^{-132}\right):\\
\;\;\;\;t + y \cdot z\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(z + x \cdot y\right)\\
\end{array}
\]
| Alternative 5 |
|---|
| Error | 8.74% |
|---|
| Cost | 713 |
|---|
\[\begin{array}{l}
\mathbf{if}\;z \leq -1.04 \cdot 10^{+65} \lor \neg \left(z \leq 2.95 \cdot 10^{+54}\right):\\
\;\;\;\;t + y \cdot z\\
\mathbf{else}:\\
\;\;\;\;t + y \cdot \left(x \cdot y\right)\\
\end{array}
\]
| Alternative 6 |
|---|
| Error | 0.1% |
|---|
| Cost | 704 |
|---|
\[t + \left(y \cdot \left(x \cdot y\right) + y \cdot z\right)
\]
| Alternative 7 |
|---|
| Error | 0.1% |
|---|
| Cost | 576 |
|---|
\[t + y \cdot \left(z + x \cdot y\right)
\]
| Alternative 8 |
|---|
| Error | 19.77% |
|---|
| Cost | 452 |
|---|
\[\begin{array}{l}
\mathbf{if}\;y \leq -1.2 \cdot 10^{+112}:\\
\;\;\;\;y \cdot \left(x \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;t + y \cdot z\\
\end{array}
\]
| Alternative 9 |
|---|
| Error | 46.54% |
|---|
| Cost | 64 |
|---|
\[t
\]