\[ \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 5 \cdot 10^{-41}:\\
\;\;\;\;\mathsf{fma}\left(a, 27 \cdot b, x \cdot 2 - y \cdot \left(t \cdot \left(z \cdot 9\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot 2 + t \cdot \left(y \cdot \left(z \cdot -9\right)\right)\right) + b \cdot \left(a \cdot 27\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 5e-41)
(fma a (* 27.0 b) (- (* x 2.0) (* y (* t (* z 9.0)))))
(+ (+ (* x 2.0) (* t (* y (* z -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 <= 5e-41) {
tmp = fma(a, (27.0 * b), ((x * 2.0) - (y * (t * (z * 9.0)))));
} else {
tmp = ((x * 2.0) + (t * (y * (z * -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 <= 5e-41)
tmp = fma(a, Float64(27.0 * b), Float64(Float64(x * 2.0) - Float64(y * Float64(t * Float64(z * 9.0)))));
else
tmp = Float64(Float64(Float64(x * 2.0) + Float64(t * Float64(y * Float64(z * -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, 5e-41], N[(a * N[(27.0 * b), $MachinePrecision] + N[(N[(x * 2.0), $MachinePrecision] - N[(y * N[(t * N[(z * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * 2.0), $MachinePrecision] + N[(t * N[(y * N[(z * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(b * N[(a * 27.0), $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 5 \cdot 10^{-41}:\\
\;\;\;\;\mathsf{fma}\left(a, 27 \cdot b, x \cdot 2 - y \cdot \left(t \cdot \left(z \cdot 9\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot 2 + t \cdot \left(y \cdot \left(z \cdot -9\right)\right)\right) + b \cdot \left(a \cdot 27\right)\\
\end{array}
Alternatives Alternative 1 Accuracy 99.2% Cost 7492
\[\begin{array}{l}
\mathbf{if}\;z \leq 1.5 \cdot 10^{-40}:\\
\;\;\;\;\mathsf{fma}\left(a, 27 \cdot b, x \cdot 2 - y \cdot \left(t \cdot \left(z \cdot 9\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot 2 - t \cdot \left(z \cdot \left(y \cdot 9\right)\right)\right) + b \cdot \left(a \cdot 27\right)\\
\end{array}
\]
Alternative 2 Accuracy 77.7% Cost 1492
\[\begin{array}{l}
t_1 := x \cdot 2 + \left(z \cdot t\right) \cdot \left(y \cdot -9\right)\\
t_2 := 27 \cdot \left(a \cdot b\right)\\
t_3 := t_2 + x \cdot 2\\
\mathbf{if}\;b \leq -1.6 \cdot 10^{-176}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;b \leq 1.5 \cdot 10^{-61}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;b \leq 7 \cdot 10^{+17}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;b \leq 3 \cdot 10^{+87}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;b \leq 5.5 \cdot 10^{+115}:\\
\;\;\;\;t_2 - 9 \cdot \left(y \cdot \left(z \cdot t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_3\\
\end{array}
\]
Alternative 3 Accuracy 77.5% Cost 1492
\[\begin{array}{l}
t_1 := x \cdot 2 + \left(z \cdot t\right) \cdot \left(y \cdot -9\right)\\
t_2 := 27 \cdot \left(a \cdot b\right)\\
t_3 := t_2 + t \cdot \left(y \cdot \left(z \cdot -9\right)\right)\\
t_4 := t_2 + x \cdot 2\\
\mathbf{if}\;b \leq -5.2 \cdot 10^{-177}:\\
\;\;\;\;t_4\\
\mathbf{elif}\;b \leq 1.2 \cdot 10^{-8}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;b \leq 400:\\
\;\;\;\;t_3\\
\mathbf{elif}\;b \leq 1.02 \cdot 10^{+86}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;b \leq 3.8 \cdot 10^{+115}:\\
\;\;\;\;t_3\\
\mathbf{else}:\\
\;\;\;\;t_4\\
\end{array}
\]
Alternative 4 Accuracy 97.6% Cost 1220
\[\begin{array}{l}
\mathbf{if}\;z \leq 2.1 \cdot 10^{+57}:\\
\;\;\;\;a \cdot \left(27 \cdot b\right) + \left(x \cdot 2 + \left(z \cdot t\right) \cdot \left(y \cdot -9\right)\right)\\
\mathbf{else}:\\
\;\;\;\;27 \cdot \left(a \cdot b\right) + t \cdot \left(y \cdot \left(z \cdot -9\right)\right)\\
\end{array}
\]
Alternative 5 Accuracy 98.9% Cost 1220
\[\begin{array}{l}
t_1 := a \cdot \left(27 \cdot b\right)\\
\mathbf{if}\;z \leq 2 \cdot 10^{-57}:\\
\;\;\;\;t_1 + \left(x \cdot 2 + \left(z \cdot t\right) \cdot \left(y \cdot -9\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_1 + \left(x \cdot 2 + \left(z \cdot y\right) \cdot \left(t \cdot -9\right)\right)\\
\end{array}
\]
Alternative 6 Accuracy 99.0% Cost 1220
\[\begin{array}{l}
\mathbf{if}\;z \leq 2.8 \cdot 10^{-58}:\\
\;\;\;\;a \cdot \left(27 \cdot b\right) + \left(x \cdot 2 + \left(z \cdot t\right) \cdot \left(y \cdot -9\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot 2 - t \cdot \left(z \cdot \left(y \cdot 9\right)\right)\right) + b \cdot \left(a \cdot 27\right)\\
\end{array}
\]
Alternative 7 Accuracy 55.1% Cost 1112
\[\begin{array}{l}
t_1 := 27 \cdot \left(a \cdot b\right)\\
t_2 := t \cdot \left(y \cdot \left(z \cdot -9\right)\right)\\
\mathbf{if}\;x \leq -7000000:\\
\;\;\;\;x \cdot 2\\
\mathbf{elif}\;x \leq -1.9 \cdot 10^{-270}:\\
\;\;\;\;b \cdot \left(a \cdot 27\right)\\
\mathbf{elif}\;x \leq 5.6 \cdot 10^{-297}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq 1.9 \cdot 10^{-173}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 2.7 \cdot 10^{-79}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq 3.9 \cdot 10^{+18}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2\\
\end{array}
\]
Alternative 8 Accuracy 54.4% Cost 1112
\[\begin{array}{l}
t_1 := 27 \cdot \left(a \cdot b\right)\\
\mathbf{if}\;x \leq -4800000:\\
\;\;\;\;x \cdot 2\\
\mathbf{elif}\;x \leq -1.85 \cdot 10^{-270}:\\
\;\;\;\;b \cdot \left(a \cdot 27\right)\\
\mathbf{elif}\;x \leq 8 \cdot 10^{-298}:\\
\;\;\;\;z \cdot \left(-9 \cdot \left(y \cdot t\right)\right)\\
\mathbf{elif}\;x \leq 9.2 \cdot 10^{-254}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 6.4 \cdot 10^{-83}:\\
\;\;\;\;y \cdot \left(t \cdot \left(z \cdot -9\right)\right)\\
\mathbf{elif}\;x \leq 1.35 \cdot 10^{+18}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2\\
\end{array}
\]
Alternative 9 Accuracy 53.6% Cost 1108
\[\begin{array}{l}
\mathbf{if}\;x \leq -3800000:\\
\;\;\;\;x \cdot 2\\
\mathbf{elif}\;x \leq -3.7 \cdot 10^{-270}:\\
\;\;\;\;b \cdot \left(a \cdot 27\right)\\
\mathbf{elif}\;x \leq 1.55 \cdot 10^{-298}:\\
\;\;\;\;t \cdot \left(y \cdot \left(z \cdot -9\right)\right)\\
\mathbf{elif}\;x \leq 1.42 \cdot 10^{-260}:\\
\;\;\;\;27 \cdot \left(a \cdot b\right)\\
\mathbf{elif}\;x \leq 2.8 \cdot 10^{-69}:\\
\;\;\;\;y \cdot \left(\left(z \cdot t\right) \cdot -9\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2\\
\end{array}
\]
Alternative 10 Accuracy 53.6% Cost 1108
\[\begin{array}{l}
\mathbf{if}\;x \leq -4200000:\\
\;\;\;\;x \cdot 2\\
\mathbf{elif}\;x \leq -5 \cdot 10^{-270}:\\
\;\;\;\;b \cdot \left(a \cdot 27\right)\\
\mathbf{elif}\;x \leq 1.1 \cdot 10^{-299}:\\
\;\;\;\;t \cdot \left(y \cdot \left(z \cdot -9\right)\right)\\
\mathbf{elif}\;x \leq 1.7 \cdot 10^{-254}:\\
\;\;\;\;27 \cdot \left(a \cdot b\right)\\
\mathbf{elif}\;x \leq 2.8 \cdot 10^{-69}:\\
\;\;\;\;y \cdot \left(t \cdot \left(z \cdot -9\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2\\
\end{array}
\]
Alternative 11 Accuracy 74.1% Cost 1104
\[\begin{array}{l}
t_1 := 27 \cdot \left(a \cdot b\right) + x \cdot 2\\
t_2 := x \cdot 2 + \left(z \cdot t\right) \cdot \left(y \cdot -9\right)\\
\mathbf{if}\;z \leq -2.1 \cdot 10^{-34}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq 6 \cdot 10^{-211}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 3.5 \cdot 10^{-44}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq 3.2 \cdot 10^{+16}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(-9 \cdot \left(y \cdot t\right)\right)\\
\end{array}
\]
Alternative 12 Accuracy 55.4% Cost 850
\[\begin{array}{l}
\mathbf{if}\;x \leq -5800000 \lor \neg \left(x \leq 3.3 \cdot 10^{-150}\right) \land \left(x \leq 2.3 \cdot 10^{-83} \lor \neg \left(x \leq 2 \cdot 10^{+16}\right)\right):\\
\;\;\;\;x \cdot 2\\
\mathbf{else}:\\
\;\;\;\;27 \cdot \left(a \cdot b\right)\\
\end{array}
\]
Alternative 13 Accuracy 73.0% Cost 840
\[\begin{array}{l}
\mathbf{if}\;z \leq -2.9 \cdot 10^{-33}:\\
\;\;\;\;z \cdot \left(y \cdot \left(t \cdot -9\right)\right)\\
\mathbf{elif}\;z \leq 4.8 \cdot 10^{+16}:\\
\;\;\;\;27 \cdot \left(a \cdot b\right) + x \cdot 2\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(-9 \cdot \left(y \cdot t\right)\right)\\
\end{array}
\]
Alternative 14 Accuracy 41.3% Cost 192
\[x \cdot 2
\]