\[ \begin{array}{c}[y, z, t] = \mathsf{sort}([y, z, t])\\ [a, b] = \mathsf{sort}([a, b])\\ \end{array} \]
Math FPCore C Julia Wolfram TeX \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b
\]
↓
\[\begin{array}{l}
\mathbf{if}\;z \leq 1.4 \cdot 10^{-287}:\\
\;\;\;\;\mathsf{fma}\left(a, 27 \cdot b, x \cdot 2 - 9 \cdot \left(y \cdot \left(z \cdot t\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x, 2, \mathsf{fma}\left(t, \left(z \cdot y\right) \cdot -9, b \cdot \left(a \cdot 27\right)\right)\right)\\
\end{array}
\]
(FPCore (x y z t a b)
:precision binary64
(+ (- (* x 2.0) (* (* (* y 9.0) z) t)) (* (* a 27.0) b))) ↓
(FPCore (x y z t a b)
:precision binary64
(if (<= z 1.4e-287)
(fma a (* 27.0 b) (- (* x 2.0) (* 9.0 (* y (* z t)))))
(fma x 2.0 (fma t (* (* z y) -9.0) (* b (* a 27.0)))))) double code(double x, double y, double z, double t, double a, double b) {
return ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b);
}
↓
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= 1.4e-287) {
tmp = fma(a, (27.0 * b), ((x * 2.0) - (9.0 * (y * (z * t)))));
} else {
tmp = fma(x, 2.0, fma(t, ((z * y) * -9.0), (b * (a * 27.0))));
}
return tmp;
}
function code(x, y, z, t, a, b)
return Float64(Float64(Float64(x * 2.0) - Float64(Float64(Float64(y * 9.0) * z) * t)) + Float64(Float64(a * 27.0) * b))
end
↓
function code(x, y, z, t, a, b)
tmp = 0.0
if (z <= 1.4e-287)
tmp = fma(a, Float64(27.0 * b), Float64(Float64(x * 2.0) - Float64(9.0 * Float64(y * Float64(z * t)))));
else
tmp = fma(x, 2.0, fma(t, Float64(Float64(z * y) * -9.0), Float64(b * Float64(a * 27.0))));
end
return tmp
end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x * 2.0), $MachinePrecision] - N[(N[(N[(y * 9.0), $MachinePrecision] * z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] + N[(N[(a * 27.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]
↓
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, 1.4e-287], N[(a * N[(27.0 * b), $MachinePrecision] + N[(N[(x * 2.0), $MachinePrecision] - N[(9.0 * N[(y * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * 2.0 + N[(t * N[(N[(z * y), $MachinePrecision] * -9.0), $MachinePrecision] + N[(b * N[(a * 27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b
↓
\begin{array}{l}
\mathbf{if}\;z \leq 1.4 \cdot 10^{-287}:\\
\;\;\;\;\mathsf{fma}\left(a, 27 \cdot b, x \cdot 2 - 9 \cdot \left(y \cdot \left(z \cdot t\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x, 2, \mathsf{fma}\left(t, \left(z \cdot y\right) \cdot -9, b \cdot \left(a \cdot 27\right)\right)\right)\\
\end{array}
Alternatives Alternative 1 Accuracy 98.8% Cost 13764
\[\begin{array}{l}
\mathbf{if}\;z \leq 1.4 \cdot 10^{-287}:\\
\;\;\;\;\mathsf{fma}\left(a, 27 \cdot b, x \cdot 2 - 9 \cdot \left(y \cdot \left(z \cdot t\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x, 2, \mathsf{fma}\left(t, \left(z \cdot y\right) \cdot -9, b \cdot \left(a \cdot 27\right)\right)\right)\\
\end{array}
\]
Alternative 2 Accuracy 98.5% Cost 7492
\[\begin{array}{l}
\mathbf{if}\;z \leq 10^{-287}:\\
\;\;\;\;\mathsf{fma}\left(a, 27 \cdot b, x \cdot 2 - 9 \cdot \left(y \cdot \left(z \cdot t\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2 - \left(a \cdot \left(b \cdot -27\right) + 9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\right)\\
\end{array}
\]
Alternative 3 Accuracy 81.2% Cost 1609
\[\begin{array}{l}
t_1 := b \cdot \left(a \cdot 27\right)\\
\mathbf{if}\;t_1 \leq -1.5 \cdot 10^{-65} \lor \neg \left(t_1 \leq 4 \cdot 10^{+132}\right):\\
\;\;\;\;27 \cdot \left(a \cdot b\right) - 9 \cdot \left(y \cdot \left(z \cdot t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2 - 9 \cdot \left(z \cdot \left(y \cdot t\right)\right)\\
\end{array}
\]
Alternative 4 Accuracy 47.9% Cost 1372
\[\begin{array}{l}
t_1 := -9 \cdot \left(y \cdot \left(z \cdot t\right)\right)\\
\mathbf{if}\;z \leq -3.7 \cdot 10^{-14}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -2.3 \cdot 10^{-256}:\\
\;\;\;\;x \cdot 2\\
\mathbf{elif}\;z \leq 9.8 \cdot 10^{-290}:\\
\;\;\;\;27 \cdot \left(a \cdot b\right)\\
\mathbf{elif}\;z \leq 4.1 \cdot 10^{-216}:\\
\;\;\;\;x \cdot 2\\
\mathbf{elif}\;z \leq 1.3 \cdot 10^{-135}:\\
\;\;\;\;a \cdot \left(27 \cdot b\right)\\
\mathbf{elif}\;z \leq 1.65 \cdot 10^{-21}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 5 \cdot 10^{+31}:\\
\;\;\;\;x \cdot 2\\
\mathbf{else}:\\
\;\;\;\;-9 \cdot \left(z \cdot \left(y \cdot t\right)\right)\\
\end{array}
\]
Alternative 5 Accuracy 96.6% Cost 1220
\[\begin{array}{l}
\mathbf{if}\;z \leq 6.5 \cdot 10^{+39}:\\
\;\;\;\;b \cdot \left(a \cdot 27\right) + \left(x \cdot 2 - y \cdot \left(z \cdot \left(9 \cdot t\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2 - z \cdot \left(9 \cdot \left(y \cdot t\right)\right)\\
\end{array}
\]
Alternative 6 Accuracy 98.1% Cost 1220
\[\begin{array}{l}
t_1 := b \cdot \left(a \cdot 27\right)\\
\mathbf{if}\;z \leq 10^{-287}:\\
\;\;\;\;t_1 + \left(x \cdot 2 - y \cdot \left(z \cdot \left(9 \cdot t\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_1 + \left(x \cdot 2 - t \cdot \left(9 \cdot \left(z \cdot y\right)\right)\right)\\
\end{array}
\]
Alternative 7 Accuracy 98.1% Cost 1220
\[\begin{array}{l}
t_1 := b \cdot \left(a \cdot 27\right)\\
\mathbf{if}\;z \leq 10^{-287}:\\
\;\;\;\;t_1 + \left(x \cdot 2 - y \cdot \left(z \cdot \left(9 \cdot t\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_1 + \left(x \cdot 2 - t \cdot \left(z \cdot \left(9 \cdot y\right)\right)\right)\\
\end{array}
\]
Alternative 8 Accuracy 98.1% Cost 1220
\[\begin{array}{l}
\mathbf{if}\;z \leq 2 \cdot 10^{-287}:\\
\;\;\;\;b \cdot \left(a \cdot 27\right) + \left(x \cdot 2 - y \cdot \left(z \cdot \left(9 \cdot t\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2 - \left(a \cdot \left(b \cdot -27\right) + 9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\right)\\
\end{array}
\]
Alternative 9 Accuracy 98.0% Cost 1220
\[\begin{array}{l}
\mathbf{if}\;z \leq 1.2 \cdot 10^{-287}:\\
\;\;\;\;x \cdot 2 - \left(\left(z \cdot t\right) \cdot \left(9 \cdot y\right) - a \cdot \left(27 \cdot b\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2 - \left(a \cdot \left(b \cdot -27\right) + 9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\right)\\
\end{array}
\]
Alternative 10 Accuracy 74.5% Cost 1104
\[\begin{array}{l}
t_1 := x \cdot 2 - a \cdot \left(b \cdot -27\right)\\
\mathbf{if}\;z \leq -2.8 \cdot 10^{+47}:\\
\;\;\;\;y \cdot \left(\left(z \cdot t\right) \cdot -9\right)\\
\mathbf{elif}\;z \leq 7.4 \cdot 10^{-65}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 1.1 \cdot 10^{-25}:\\
\;\;\;\;\left(z \cdot y\right) \cdot \left(t \cdot -9\right)\\
\mathbf{elif}\;z \leq 3.3 \cdot 10^{+32}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;-9 \cdot \left(z \cdot \left(y \cdot t\right)\right)\\
\end{array}
\]
Alternative 11 Accuracy 77.3% Cost 1100
\[\begin{array}{l}
t_1 := x \cdot 2 - 9 \cdot \left(y \cdot \left(z \cdot t\right)\right)\\
\mathbf{if}\;z \leq -2.65 \cdot 10^{-28}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 8.8 \cdot 10^{-136}:\\
\;\;\;\;x \cdot 2 - a \cdot \left(b \cdot -27\right)\\
\mathbf{elif}\;z \leq 1.15 \cdot 10^{+35}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;-9 \cdot \left(z \cdot \left(y \cdot t\right)\right)\\
\end{array}
\]
Alternative 12 Accuracy 78.2% Cost 969
\[\begin{array}{l}
\mathbf{if}\;z \leq -1.45 \cdot 10^{-25} \lor \neg \left(z \leq 1.22 \cdot 10^{-135}\right):\\
\;\;\;\;x \cdot 2 - 9 \cdot \left(z \cdot \left(y \cdot t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2 - a \cdot \left(b \cdot -27\right)\\
\end{array}
\]
Alternative 13 Accuracy 78.2% Cost 968
\[\begin{array}{l}
\mathbf{if}\;z \leq -2.05 \cdot 10^{-23}:\\
\;\;\;\;x \cdot 2 - 9 \cdot \left(z \cdot \left(y \cdot t\right)\right)\\
\mathbf{elif}\;z \leq 3.1 \cdot 10^{-134}:\\
\;\;\;\;x \cdot 2 - a \cdot \left(b \cdot -27\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2 - z \cdot \left(9 \cdot \left(y \cdot t\right)\right)\\
\end{array}
\]
Alternative 14 Accuracy 46.1% Cost 713
\[\begin{array}{l}
\mathbf{if}\;t \leq -2 \cdot 10^{-177} \lor \neg \left(t \leq 3.4 \cdot 10^{+59}\right):\\
\;\;\;\;-9 \cdot \left(y \cdot \left(z \cdot t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2\\
\end{array}
\]
Alternative 15 Accuracy 47.7% Cost 712
\[\begin{array}{l}
\mathbf{if}\;t \leq -5.2 \cdot 10^{-171}:\\
\;\;\;\;-9 \cdot \left(y \cdot \left(z \cdot t\right)\right)\\
\mathbf{elif}\;t \leq 2.2 \cdot 10^{+59}:\\
\;\;\;\;x \cdot 2\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(y \cdot \left(z \cdot -9\right)\right)\\
\end{array}
\]
Alternative 16 Accuracy 47.7% Cost 712
\[\begin{array}{l}
\mathbf{if}\;t \leq -5.2 \cdot 10^{-171}:\\
\;\;\;\;y \cdot \left(\left(z \cdot t\right) \cdot -9\right)\\
\mathbf{elif}\;t \leq 2.3 \cdot 10^{+59}:\\
\;\;\;\;x \cdot 2\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(y \cdot \left(z \cdot -9\right)\right)\\
\end{array}
\]
Alternative 17 Accuracy 47.7% Cost 712
\[\begin{array}{l}
\mathbf{if}\;t \leq -5.2 \cdot 10^{-171}:\\
\;\;\;\;y \cdot \left(\left(z \cdot t\right) \cdot -9\right)\\
\mathbf{elif}\;t \leq 2.75 \cdot 10^{+60}:\\
\;\;\;\;x \cdot 2\\
\mathbf{else}:\\
\;\;\;\;\left(z \cdot y\right) \cdot \left(t \cdot -9\right)\\
\end{array}
\]
Alternative 18 Accuracy 46.9% Cost 584
\[\begin{array}{l}
\mathbf{if}\;x \leq -1.45 \cdot 10^{-22}:\\
\;\;\;\;x \cdot 2\\
\mathbf{elif}\;x \leq 1.45:\\
\;\;\;\;27 \cdot \left(a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2\\
\end{array}
\]
Alternative 19 Accuracy 46.9% Cost 584
\[\begin{array}{l}
\mathbf{if}\;x \leq -1.1 \cdot 10^{-22}:\\
\;\;\;\;x \cdot 2\\
\mathbf{elif}\;x \leq 1.8:\\
\;\;\;\;a \cdot \left(27 \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2\\
\end{array}
\]
Alternative 20 Accuracy 30.2% Cost 192
\[x \cdot 2
\]