\[\left(\left(x \cdot y + z \cdot z\right) + z \cdot z\right) + z \cdot z
\]
↓
\[\mathsf{fma}\left(z, z + z, \mathsf{fma}\left(x, y, z \cdot z\right)\right)
\]
(FPCore (x y z)
:precision binary64
(+ (+ (+ (* x y) (* z z)) (* z z)) (* z z)))
↓
(FPCore (x y z) :precision binary64 (fma z (+ z z) (fma x y (* z z))))
double code(double x, double y, double z) {
return (((x * y) + (z * z)) + (z * z)) + (z * z);
}
↓
double code(double x, double y, double z) {
return fma(z, (z + z), fma(x, y, (z * z)));
}
function code(x, y, z)
return Float64(Float64(Float64(Float64(x * y) + Float64(z * z)) + Float64(z * z)) + Float64(z * z))
end
↓
function code(x, y, z)
return fma(z, Float64(z + z), fma(x, y, Float64(z * z)))
end
code[x_, y_, z_] := N[(N[(N[(N[(x * y), $MachinePrecision] + N[(z * z), $MachinePrecision]), $MachinePrecision] + N[(z * z), $MachinePrecision]), $MachinePrecision] + N[(z * z), $MachinePrecision]), $MachinePrecision]
↓
code[x_, y_, z_] := N[(z * N[(z + z), $MachinePrecision] + N[(x * y + N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(\left(x \cdot y + z \cdot z\right) + z \cdot z\right) + z \cdot z
↓
\mathsf{fma}\left(z, z + z, \mathsf{fma}\left(x, y, z \cdot z\right)\right)
Alternatives
| Alternative 1 |
|---|
| Error | 12.8 |
|---|
| Cost | 976 |
|---|
\[\begin{array}{l}
t_0 := \left(z \cdot z\right) \cdot 3\\
t_1 := z \cdot z + x \cdot y\\
\mathbf{if}\;z \leq -27689.12722169995:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -1.487393591883637 \cdot 10^{-57}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -1.0093204801178489 \cdot 10^{-117}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 9.92149702785056 \cdot 10^{+50}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(z \cdot 3\right)\\
\end{array}
\]
| Alternative 2 |
|---|
| Error | 13.4 |
|---|
| Cost | 848 |
|---|
\[\begin{array}{l}
t_0 := z \cdot \left(z \cdot 3\right)\\
\mathbf{if}\;z \leq -27689.12722169995:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -1.487393591883637 \cdot 10^{-57}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;z \leq -1.0093204801178489 \cdot 10^{-117}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 6.206492760354703 \cdot 10^{+28}:\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
| Alternative 3 |
|---|
| Error | 13.4 |
|---|
| Cost | 848 |
|---|
\[\begin{array}{l}
t_0 := \left(z \cdot z\right) \cdot 3\\
\mathbf{if}\;z \leq -27689.12722169995:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -1.487393591883637 \cdot 10^{-57}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;z \leq -1.0093204801178489 \cdot 10^{-117}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 6.206492760354703 \cdot 10^{+28}:\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(z \cdot 3\right)\\
\end{array}
\]
| Alternative 4 |
|---|
| Error | 0.1 |
|---|
| Cost | 832 |
|---|
\[z \cdot z + \left(z \cdot \left(z + z\right) + x \cdot y\right)
\]
| Alternative 5 |
|---|
| Error | 0.1 |
|---|
| Cost | 576 |
|---|
\[z \cdot \left(z \cdot 3\right) + x \cdot y
\]
| Alternative 6 |
|---|
| Error | 23.4 |
|---|
| Cost | 324 |
|---|
\[\begin{array}{l}
\mathbf{if}\;z \leq 9.92149702785056 \cdot 10^{+50}:\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;z \cdot z\\
\end{array}
\]
| Alternative 7 |
|---|
| Error | 55.5 |
|---|
| Cost | 192 |
|---|
\[z \cdot z
\]