\[\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.9 |
|---|
| Cost | 976 |
|---|
\[\begin{array}{l}
t_1 := t + y \cdot z\\
t_2 := y \cdot \left(z + x \cdot y\right)\\
\mathbf{if}\;t \leq -1.25 \cdot 10^{-96}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 4.8 \cdot 10^{-155}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t \leq 7.5 \cdot 10^{-32}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 0.021:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t + x \cdot \left(y \cdot y\right)\\
\end{array}
\]
| Alternative 2 |
|---|
| Error | 24.8 |
|---|
| Cost | 848 |
|---|
\[\begin{array}{l}
\mathbf{if}\;t \leq -1.2 \cdot 10^{-90}:\\
\;\;\;\;t\\
\mathbf{elif}\;t \leq 1.02 \cdot 10^{-70}:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;t \leq 7.5 \cdot 10^{-31}:\\
\;\;\;\;t\\
\mathbf{elif}\;t \leq 0.021:\\
\;\;\;\;y \cdot \left(x \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\]
| Alternative 3 |
|---|
| Error | 9.3 |
|---|
| Cost | 713 |
|---|
\[\begin{array}{l}
\mathbf{if}\;y \leq -0.00053 \lor \neg \left(y \leq 9.2 \cdot 10^{-18}\right):\\
\;\;\;\;y \cdot \left(z + x \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;t + y \cdot z\\
\end{array}
\]
| Alternative 4 |
|---|
| Error | 4.9 |
|---|
| Cost | 713 |
|---|
\[\begin{array}{l}
\mathbf{if}\;z \leq -1 \cdot 10^{-5} \lor \neg \left(z \leq 5.2 \cdot 10^{-37}\right):\\
\;\;\;\;t + y \cdot z\\
\mathbf{else}:\\
\;\;\;\;t + y \cdot \left(x \cdot y\right)\\
\end{array}
\]
| Alternative 5 |
|---|
| Error | 14.2 |
|---|
| Cost | 585 |
|---|
\[\begin{array}{l}
\mathbf{if}\;y \leq 1.1 \cdot 10^{+15} \lor \neg \left(y \leq 2.9 \cdot 10^{+110}\right):\\
\;\;\;\;t + y \cdot z\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(x \cdot y\right)\\
\end{array}
\]
| Alternative 6 |
|---|
| Error | 0.1 |
|---|
| Cost | 576 |
|---|
\[t + y \cdot \left(z + x \cdot y\right)
\]
| Alternative 7 |
|---|
| Error | 24.5 |
|---|
| Cost | 456 |
|---|
\[\begin{array}{l}
\mathbf{if}\;t \leq -2.9 \cdot 10^{-86}:\\
\;\;\;\;t\\
\mathbf{elif}\;t \leq 1.85 \cdot 10^{-70}:\\
\;\;\;\;y \cdot z\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\]
| Alternative 8 |
|---|
| Error | 30.0 |
|---|
| Cost | 64 |
|---|
\[t
\]