\[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5
\]
↓
\[\mathsf{fma}\left(y, 5, x \cdot \left(t + \left(y + z\right) \cdot 2\right)\right)
\]
(FPCore (x y z t)
:precision binary64
(+ (* x (+ (+ (+ (+ y z) z) y) t)) (* y 5.0)))
↓
(FPCore (x y z t) :precision binary64 (fma y 5.0 (* x (+ t (* (+ y z) 2.0)))))
double code(double x, double y, double z, double t) {
return (x * ((((y + z) + z) + y) + t)) + (y * 5.0);
}
↓
double code(double x, double y, double z, double t) {
return fma(y, 5.0, (x * (t + ((y + z) * 2.0))));
}
function code(x, y, z, t)
return Float64(Float64(x * Float64(Float64(Float64(Float64(y + z) + z) + y) + t)) + Float64(y * 5.0))
end
↓
function code(x, y, z, t)
return fma(y, 5.0, Float64(x * Float64(t + Float64(Float64(y + z) * 2.0))))
end
code[x_, y_, z_, t_] := N[(N[(x * N[(N[(N[(N[(y + z), $MachinePrecision] + z), $MachinePrecision] + y), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision] + N[(y * 5.0), $MachinePrecision]), $MachinePrecision]
↓
code[x_, y_, z_, t_] := N[(y * 5.0 + N[(x * N[(t + N[(N[(y + z), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5
↓
\mathsf{fma}\left(y, 5, x \cdot \left(t + \left(y + z\right) \cdot 2\right)\right)
Alternatives
| Alternative 1 |
|---|
| Error | 10.2 |
|---|
| Cost | 1760 |
|---|
\[\begin{array}{l}
t_1 := x \cdot t + y \cdot 5\\
t_2 := x \cdot \left(t + z \cdot 2\right)\\
t_3 := \left(y + z\right) \cdot 2\\
t_4 := x \cdot t_3 + y \cdot 5\\
t_5 := x \cdot \left(t + t_3\right)\\
\mathbf{if}\;x \leq -62000000:\\
\;\;\;\;t_5\\
\mathbf{elif}\;x \leq -1.5 \cdot 10^{-26}:\\
\;\;\;\;t_4\\
\mathbf{elif}\;x \leq -5.8 \cdot 10^{-71}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq -2.5 \cdot 10^{-107}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -5.2 \cdot 10^{-130}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq -1.2 \cdot 10^{-241}:\\
\;\;\;\;t_4\\
\mathbf{elif}\;x \leq 3.3 \cdot 10^{-265}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 9.5 \cdot 10^{-10}:\\
\;\;\;\;t_4\\
\mathbf{else}:\\
\;\;\;\;t_5\\
\end{array}
\]
| Alternative 2 |
|---|
| Error | 26.1 |
|---|
| Cost | 1637 |
|---|
\[\begin{array}{l}
t_1 := \left(y + z\right) \cdot \left(x \cdot 2\right)\\
\mathbf{if}\;x \leq -20000:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -1.15 \cdot 10^{-15}:\\
\;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\
\mathbf{elif}\;x \leq -5.8 \cdot 10^{-71}:\\
\;\;\;\;2 \cdot \left(x \cdot z\right)\\
\mathbf{elif}\;x \leq 1.9 \cdot 10^{-95}:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;x \leq 3.1 \cdot 10^{-35}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 9.8 \cdot 10^{-17}:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;x \leq 3.5 \cdot 10^{-6} \lor \neg \left(x \leq 9 \cdot 10^{+61}\right) \land x \leq 4.6 \cdot 10^{+212}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(t + y \cdot 2\right)\\
\end{array}
\]
| Alternative 3 |
|---|
| Error | 10.5 |
|---|
| Cost | 1497 |
|---|
\[\begin{array}{l}
t_1 := y \cdot \left(5 + x \cdot 2\right) + x \cdot t\\
t_2 := x \cdot \left(t + \left(y + z\right) \cdot 2\right)\\
\mathbf{if}\;x \leq -2500:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq -3 \cdot 10^{-7}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -3.5 \cdot 10^{-71}:\\
\;\;\;\;x \cdot \left(t + z \cdot 2\right)\\
\mathbf{elif}\;x \leq 2.8 \cdot 10^{-95}:\\
\;\;\;\;x \cdot t + y \cdot 5\\
\mathbf{elif}\;x \leq 2.8 \cdot 10^{-35} \lor \neg \left(x \leq 1.02 \cdot 10^{-16}\right):\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
| Alternative 4 |
|---|
| Error | 10.7 |
|---|
| Cost | 1369 |
|---|
\[\begin{array}{l}
t_1 := x \cdot \left(t + \left(y + z\right) \cdot 2\right)\\
\mathbf{if}\;x \leq -155:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -2.7 \cdot 10^{-5}:\\
\;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\
\mathbf{elif}\;x \leq -6.5 \cdot 10^{-72}:\\
\;\;\;\;x \cdot \left(t + z \cdot 2\right)\\
\mathbf{elif}\;x \leq 2.8 \cdot 10^{-95} \lor \neg \left(x \leq 2.5 \cdot 10^{-35}\right) \land x \leq 1.02 \cdot 10^{-16}:\\
\;\;\;\;x \cdot t + y \cdot 5\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
| Alternative 5 |
|---|
| Error | 10.7 |
|---|
| Cost | 1369 |
|---|
\[\begin{array}{l}
t_1 := x \cdot \left(t + \left(y + z\right) \cdot 2\right)\\
\mathbf{if}\;x \leq -155:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -1.7 \cdot 10^{-11}:\\
\;\;\;\;y \cdot 5 + x \cdot \left(y \cdot 2\right)\\
\mathbf{elif}\;x \leq -5.8 \cdot 10^{-71}:\\
\;\;\;\;x \cdot \left(t + z \cdot 2\right)\\
\mathbf{elif}\;x \leq 2 \cdot 10^{-96} \lor \neg \left(x \leq 3.4 \cdot 10^{-35}\right) \land x \leq 8.2 \cdot 10^{-17}:\\
\;\;\;\;x \cdot t + y \cdot 5\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
| Alternative 6 |
|---|
| Error | 25.0 |
|---|
| Cost | 1240 |
|---|
\[\begin{array}{l}
t_1 := \left(y + z\right) \cdot \left(x \cdot 2\right)\\
t_2 := y \cdot \left(5 + x \cdot 2\right)\\
\mathbf{if}\;y \leq -4.1 \cdot 10^{-26}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y \leq -3.8 \cdot 10^{-149}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -3.5 \cdot 10^{-261}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;y \leq 5.1 \cdot 10^{-173}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 2.2 \cdot 10^{-136}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;y \leq 1.66 \cdot 10^{-66}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\]
| Alternative 7 |
|---|
| Error | 31.2 |
|---|
| Cost | 1112 |
|---|
\[\begin{array}{l}
t_1 := 2 \cdot \left(x \cdot z\right)\\
\mathbf{if}\;y \leq -2.1 \cdot 10^{-26}:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;y \leq -2.7 \cdot 10^{-149}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -1.45 \cdot 10^{-259}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;y \leq 4 \cdot 10^{-174}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 1.3 \cdot 10^{-134}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;y \leq 1.36 \cdot 10^{-70}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5\\
\end{array}
\]
| Alternative 8 |
|---|
| Error | 26.2 |
|---|
| Cost | 978 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq -4.8 \cdot 10^{-71} \lor \neg \left(x \leq 2.3 \cdot 10^{-95} \lor \neg \left(x \leq 5 \cdot 10^{-35}\right) \land x \leq 5.8 \cdot 10^{-17}\right):\\
\;\;\;\;\left(y + z\right) \cdot \left(x \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5\\
\end{array}
\]
| Alternative 9 |
|---|
| Error | 14.8 |
|---|
| Cost | 976 |
|---|
\[\begin{array}{l}
t_1 := x \cdot \left(t + z \cdot 2\right)\\
t_2 := y \cdot \left(5 + x \cdot 2\right)\\
\mathbf{if}\;y \leq -2.05 \cdot 10^{-53}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y \leq 5.8 \cdot 10^{-68}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 6.6 \cdot 10^{-28}:\\
\;\;\;\;x \cdot t + y \cdot 5\\
\mathbf{elif}\;y \leq 4 \cdot 10^{+51}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\]
| Alternative 10 |
|---|
| Error | 0.1 |
|---|
| Cost | 960 |
|---|
\[x \cdot \left(t + \left(y + \left(z + \left(y + z\right)\right)\right)\right) + y \cdot 5
\]
| Alternative 11 |
|---|
| Error | 0.1 |
|---|
| Cost | 960 |
|---|
\[x \cdot \left(t + z \cdot 2\right) + y \cdot \left(5 + x \cdot 2\right)
\]
| Alternative 12 |
|---|
| Error | 14.8 |
|---|
| Cost | 713 |
|---|
\[\begin{array}{l}
\mathbf{if}\;y \leq -8.5 \cdot 10^{-50} \lor \neg \left(y \leq 3.3 \cdot 10^{+51}\right):\\
\;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(t + z \cdot 2\right)\\
\end{array}
\]
| Alternative 13 |
|---|
| Error | 31.7 |
|---|
| Cost | 456 |
|---|
\[\begin{array}{l}
\mathbf{if}\;y \leq -2.85 \cdot 10^{-105}:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;y \leq 3 \cdot 10^{+22}:\\
\;\;\;\;x \cdot t\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5\\
\end{array}
\]
| Alternative 14 |
|---|
| Error | 37.9 |
|---|
| Cost | 192 |
|---|
\[y \cdot 5
\]