\[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 | 0.1 |
|---|
| Cost | 7104 |
|---|
\[\mathsf{fma}\left(x, t + \left(y + z\right) \cdot 2, y \cdot 5\right)
\]
| Alternative 2 |
|---|
| Error | 9.6 |
|---|
| Cost | 1500 |
|---|
\[\begin{array}{l}
t_1 := y \cdot 5 + \left(y + z\right) \cdot \left(x \cdot 2\right)\\
t_2 := x \cdot \left(t + \left(y + z\right) \cdot 2\right)\\
t_3 := y \cdot 5 + x \cdot t\\
\mathbf{if}\;x \leq -35000:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq -8.6 \cdot 10^{-95}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -1.6 \cdot 10^{-163}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;x \leq -1.45 \cdot 10^{-202}:\\
\;\;\;\;y \cdot 5 + 2 \cdot \left(x \cdot z\right)\\
\mathbf{elif}\;x \leq 3 \cdot 10^{-281}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;x \leq 5 \cdot 10^{-80}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 5.1 \cdot 10^{-5}:\\
\;\;\;\;t_3\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\]
| Alternative 3 |
|---|
| Error | 32.2 |
|---|
| Cost | 1248 |
|---|
\[\begin{array}{l}
t_1 := 2 \cdot \left(x \cdot z\right)\\
\mathbf{if}\;y \leq -3.5 \cdot 10^{-57}:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;y \leq -2.05 \cdot 10^{-136}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 5.5 \cdot 10^{-268}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;y \leq 3.6 \cdot 10^{-151}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 5.8 \cdot 10^{-96}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;y \leq 6 \cdot 10^{-57}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 10^{-46}:\\
\;\;\;\;y \cdot \left(x + x\right)\\
\mathbf{elif}\;y \leq 3 \cdot 10^{+38}:\\
\;\;\;\;x \cdot t\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5\\
\end{array}
\]
| Alternative 4 |
|---|
| Error | 7.8 |
|---|
| Cost | 1232 |
|---|
\[\begin{array}{l}
t_1 := y \cdot 5 + \left(y + z\right) \cdot \left(x \cdot 2\right)\\
t_2 := y \cdot 5 + x \cdot \left(t + y \cdot 2\right)\\
\mathbf{if}\;t \leq -2.7 \cdot 10^{+80}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t \leq -30:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq -4.4 \cdot 10^{-42}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t \leq 2.65 \cdot 10^{+25}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\]
| Alternative 5 |
|---|
| Error | 25.4 |
|---|
| Cost | 1108 |
|---|
\[\begin{array}{l}
t_1 := 2 \cdot \left(x \cdot \left(y + z\right)\right)\\
t_2 := y \cdot \left(5 + x \cdot 2\right)\\
\mathbf{if}\;y \leq -2.7 \cdot 10^{-57}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y \leq -1.18 \cdot 10^{-136}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 2.05 \cdot 10^{-268}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;y \leq 5.5 \cdot 10^{-151}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 1.5 \cdot 10^{-117}:\\
\;\;\;\;x \cdot t\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\]
| Alternative 6 |
|---|
| Error | 25.6 |
|---|
| Cost | 1108 |
|---|
\[\begin{array}{l}
t_1 := 2 \cdot \left(x \cdot \left(y + z\right)\right)\\
t_2 := y \cdot \left(5 + x \cdot 2\right)\\
t_3 := x \cdot \left(t + y \cdot 2\right)\\
\mathbf{if}\;y \leq -2.9 \cdot 10^{-57}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y \leq -1.06 \cdot 10^{-136}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 2.8 \cdot 10^{-268}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;y \leq 3.9 \cdot 10^{-151}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 5.6 \cdot 10^{+42}:\\
\;\;\;\;t_3\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\]
| Alternative 7 |
|---|
| Error | 9.7 |
|---|
| Cost | 1104 |
|---|
\[\begin{array}{l}
t_1 := y \cdot 5 + x \cdot t\\
t_2 := x \cdot \left(t + \left(y + z\right) \cdot 2\right)\\
\mathbf{if}\;x \leq -0.038:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq 3 \cdot 10^{-281}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 2.25 \cdot 10^{-80}:\\
\;\;\;\;y \cdot 5 + 2 \cdot \left(x \cdot z\right)\\
\mathbf{elif}\;x \leq 0.000205:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\]
| Alternative 8 |
|---|
| Error | 0.6 |
|---|
| Cost | 968 |
|---|
\[\begin{array}{l}
t_1 := x \cdot \left(t + \left(y + z\right) \cdot 2\right)\\
\mathbf{if}\;x \leq -2.5:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 2.5:\\
\;\;\;\;y \cdot 5 + x \cdot \left(t + z \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
| Alternative 9 |
|---|
| Error | 0.1 |
|---|
| Cost | 960 |
|---|
\[y \cdot 5 + x \cdot \left(t + \left(y + \left(z + \left(y + z\right)\right)\right)\right)
\]
| Alternative 10 |
|---|
| Error | 0.1 |
|---|
| Cost | 960 |
|---|
\[x \cdot \left(t + z \cdot 2\right) + y \cdot \left(5 + x \cdot 2\right)
\]
| Alternative 11 |
|---|
| Error | 32.1 |
|---|
| Cost | 852 |
|---|
\[\begin{array}{l}
t_1 := 2 \cdot \left(x \cdot z\right)\\
\mathbf{if}\;y \leq -2.4 \cdot 10^{-57}:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;y \leq -1.06 \cdot 10^{-136}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 1.4 \cdot 10^{-268}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;y \leq 2.3 \cdot 10^{-151}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 7 \cdot 10^{+38}:\\
\;\;\;\;x \cdot t\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5\\
\end{array}
\]
| Alternative 12 |
|---|
| Error | 26.4 |
|---|
| Cost | 844 |
|---|
\[\begin{array}{l}
t_1 := 2 \cdot \left(x \cdot \left(y + z\right)\right)\\
\mathbf{if}\;x \leq -0.038:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 8.5 \cdot 10^{-81}:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;x \leq 32500000000000:\\
\;\;\;\;x \cdot t\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
| Alternative 13 |
|---|
| Error | 15.1 |
|---|
| Cost | 844 |
|---|
\[\begin{array}{l}
t_1 := y \cdot \left(5 + x \cdot 2\right)\\
\mathbf{if}\;y \leq -2.1 \cdot 10^{+62}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -3.2 \cdot 10^{-57}:\\
\;\;\;\;y \cdot 5 + x \cdot t\\
\mathbf{elif}\;y \leq 4 \cdot 10^{+38}:\\
\;\;\;\;x \cdot \left(t + z \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
| Alternative 14 |
|---|
| Error | 9.7 |
|---|
| Cost | 840 |
|---|
\[\begin{array}{l}
t_1 := x \cdot \left(t + \left(y + z\right) \cdot 2\right)\\
\mathbf{if}\;x \leq -0.038:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 4.3 \cdot 10^{-5}:\\
\;\;\;\;y \cdot 5 + x \cdot t\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
| Alternative 15 |
|---|
| Error | 15.4 |
|---|
| Cost | 712 |
|---|
\[\begin{array}{l}
t_1 := y \cdot \left(5 + x \cdot 2\right)\\
\mathbf{if}\;y \leq -3.3 \cdot 10^{-57}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 2.2 \cdot 10^{+38}:\\
\;\;\;\;x \cdot \left(t + z \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
| Alternative 16 |
|---|
| Error | 32.3 |
|---|
| Cost | 456 |
|---|
\[\begin{array}{l}
\mathbf{if}\;y \leq -7.4 \cdot 10^{-78}:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;y \leq 5.6 \cdot 10^{+46}:\\
\;\;\;\;x \cdot t\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5\\
\end{array}
\]
| Alternative 17 |
|---|
| Error | 46.8 |
|---|
| Cost | 192 |
|---|
\[x \cdot t
\]