Math FPCore C Julia Wolfram TeX \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b
\]
↓
\[\begin{array}{l}
\mathbf{if}\;z \leq -4 \cdot 10^{+27} \lor \neg \left(z \leq 2 \cdot 10^{-56}\right):\\
\;\;\;\;\mathsf{fma}\left(z, \mathsf{fma}\left(a, b, y\right), \mathsf{fma}\left(t, a, x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, t + z \cdot b, \mathsf{fma}\left(y, z, x\right)\right)\\
\end{array}
\]
(FPCore (x y z t a b)
:precision binary64
(+ (+ (+ x (* y z)) (* t a)) (* (* a z) b))) ↓
(FPCore (x y z t a b)
:precision binary64
(if (or (<= z -4e+27) (not (<= z 2e-56)))
(fma z (fma a b y) (fma t a x))
(fma a (+ t (* z b)) (fma y z x)))) double code(double x, double y, double z, double t, double a, double b) {
return ((x + (y * z)) + (t * a)) + ((a * z) * b);
}
↓
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -4e+27) || !(z <= 2e-56)) {
tmp = fma(z, fma(a, b, y), fma(t, a, x));
} else {
tmp = fma(a, (t + (z * b)), fma(y, z, x));
}
return tmp;
}
function code(x, y, z, t, a, b)
return Float64(Float64(Float64(x + Float64(y * z)) + Float64(t * a)) + Float64(Float64(a * z) * b))
end
↓
function code(x, y, z, t, a, b)
tmp = 0.0
if ((z <= -4e+27) || !(z <= 2e-56))
tmp = fma(z, fma(a, b, y), fma(t, a, x));
else
tmp = fma(a, Float64(t + Float64(z * b)), fma(y, z, x));
end
return tmp
end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision] + N[(t * a), $MachinePrecision]), $MachinePrecision] + N[(N[(a * z), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]
↓
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -4e+27], N[Not[LessEqual[z, 2e-56]], $MachinePrecision]], N[(z * N[(a * b + y), $MachinePrecision] + N[(t * a + x), $MachinePrecision]), $MachinePrecision], N[(a * N[(t + N[(z * b), $MachinePrecision]), $MachinePrecision] + N[(y * z + x), $MachinePrecision]), $MachinePrecision]]
\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b
↓
\begin{array}{l}
\mathbf{if}\;z \leq -4 \cdot 10^{+27} \lor \neg \left(z \leq 2 \cdot 10^{-56}\right):\\
\;\;\;\;\mathsf{fma}\left(z, \mathsf{fma}\left(a, b, y\right), \mathsf{fma}\left(t, a, x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, t + z \cdot b, \mathsf{fma}\left(y, z, x\right)\right)\\
\end{array}
Alternatives Alternative 1 Accuracy 99.3% Cost 13508
\[\begin{array}{l}
t_1 := x + z \cdot y\\
\mathbf{if}\;a \leq -1 \cdot 10^{+109}:\\
\;\;\;\;\mathsf{fma}\left(a, t + z \cdot b, \mathsf{fma}\left(y, z, x\right)\right)\\
\mathbf{elif}\;a \leq 5 \cdot 10^{-12}:\\
\;\;\;\;\left(t_1 + a \cdot t\right) + b \cdot \left(z \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;t_1 + \mathsf{fma}\left(t, a, a \cdot \left(z \cdot b\right)\right)\\
\end{array}
\]
Alternative 2 Accuracy 99.3% Cost 8904
\[\begin{array}{l}
t_1 := x + z \cdot y\\
t_2 := \left(t_1 + a \cdot t\right) + b \cdot \left(z \cdot a\right)\\
\mathbf{if}\;t_2 \leq -\infty:\\
\;\;\;\;t_1 + \left(a \cdot \left(z \cdot b\right) + a \cdot t\right)\\
\mathbf{elif}\;t_2 \leq 4 \cdot 10^{+307}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t + z \cdot b, a, x\right)\\
\end{array}
\]
Alternative 3 Accuracy 99.3% Cost 7496
\[\begin{array}{l}
t_1 := a \cdot \left(z \cdot b\right)\\
t_2 := x + z \cdot y\\
\mathbf{if}\;a \leq -7.2 \cdot 10^{+108}:\\
\;\;\;\;t_2 + \left(t_1 + a \cdot t\right)\\
\mathbf{elif}\;a \leq 5 \cdot 10^{-12}:\\
\;\;\;\;\left(t_2 + a \cdot t\right) + b \cdot \left(z \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;t_2 + \mathsf{fma}\left(t, a, t_1\right)\\
\end{array}
\]
Alternative 4 Accuracy 47.3% Cost 1244
\[\begin{array}{l}
t_1 := a \cdot \left(z \cdot b\right)\\
\mathbf{if}\;x \leq -3000000000:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 4 \cdot 10^{-275}:\\
\;\;\;\;z \cdot y\\
\mathbf{elif}\;x \leq 1.1 \cdot 10^{-230}:\\
\;\;\;\;a \cdot t\\
\mathbf{elif}\;x \leq 1.85 \cdot 10^{-208}:\\
\;\;\;\;z \cdot y\\
\mathbf{elif}\;x \leq 3.6 \cdot 10^{-53}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 2200000:\\
\;\;\;\;a \cdot t\\
\mathbf{elif}\;x \leq 45000000:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\]
Alternative 5 Accuracy 47.0% Cost 1244
\[\begin{array}{l}
\mathbf{if}\;x \leq -13500000:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1.45 \cdot 10^{-276}:\\
\;\;\;\;z \cdot y\\
\mathbf{elif}\;x \leq 10^{-230}:\\
\;\;\;\;a \cdot t\\
\mathbf{elif}\;x \leq 3.4 \cdot 10^{-207}:\\
\;\;\;\;z \cdot y\\
\mathbf{elif}\;x \leq 3.4 \cdot 10^{-40}:\\
\;\;\;\;z \cdot \left(a \cdot b\right)\\
\mathbf{elif}\;x \leq 45:\\
\;\;\;\;a \cdot t\\
\mathbf{elif}\;x \leq 5.5 \cdot 10^{+17}:\\
\;\;\;\;a \cdot \left(z \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\]
Alternative 6 Accuracy 54.0% Cost 1244
\[\begin{array}{l}
t_1 := x + a \cdot t\\
\mathbf{if}\;x \leq -7.8 \cdot 10^{-59}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -6.5 \cdot 10^{-98}:\\
\;\;\;\;z \cdot y\\
\mathbf{elif}\;x \leq -5.9 \cdot 10^{-139}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -2.9 \cdot 10^{-249}:\\
\;\;\;\;b \cdot \left(z \cdot a\right)\\
\mathbf{elif}\;x \leq 9 \cdot 10^{-276}:\\
\;\;\;\;z \cdot y\\
\mathbf{elif}\;x \leq 1.15 \cdot 10^{-179}:\\
\;\;\;\;a \cdot t\\
\mathbf{elif}\;x \leq 2.15 \cdot 10^{-40}:\\
\;\;\;\;z \cdot \left(a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
Alternative 7 Accuracy 64.6% Cost 1240
\[\begin{array}{l}
t_1 := a \cdot \left(t + z \cdot b\right)\\
t_2 := x + a \cdot t\\
t_3 := z \cdot \left(y + a \cdot b\right)\\
\mathbf{if}\;x \leq -7.2 \cdot 10^{+39}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq -4 \cdot 10^{-11}:\\
\;\;\;\;x + z \cdot y\\
\mathbf{elif}\;x \leq -3 \cdot 10^{-57}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 5.8 \cdot 10^{-277}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;x \leq 6.5 \cdot 10^{-183}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 6.3 \cdot 10^{-40}:\\
\;\;\;\;t_3\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\]
Alternative 8 Accuracy 65.1% Cost 1240
\[\begin{array}{l}
t_1 := x + a \cdot t\\
t_2 := z \cdot \left(y + a \cdot b\right)\\
\mathbf{if}\;x \leq -7 \cdot 10^{+39}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -1 \cdot 10^{-14}:\\
\;\;\;\;x + z \cdot y\\
\mathbf{elif}\;x \leq -1.3 \cdot 10^{-57}:\\
\;\;\;\;a \cdot \left(t + z \cdot b\right)\\
\mathbf{elif}\;x \leq 5.4 \cdot 10^{-292}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq 3.2 \cdot 10^{-246}:\\
\;\;\;\;a \cdot t + z \cdot y\\
\mathbf{elif}\;x \leq 8 \cdot 10^{-39}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
Alternative 9 Accuracy 99.3% Cost 1225
\[\begin{array}{l}
t_1 := x + z \cdot y\\
\mathbf{if}\;a \leq -2 \cdot 10^{+110} \lor \neg \left(a \leq 5 \cdot 10^{-12}\right):\\
\;\;\;\;t_1 + \left(a \cdot \left(z \cdot b\right) + a \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t_1 + a \cdot t\right) + b \cdot \left(z \cdot a\right)\\
\end{array}
\]
Alternative 10 Accuracy 96.1% Cost 1224
\[\begin{array}{l}
t_1 := x + z \cdot \left(y + a \cdot b\right)\\
\mathbf{if}\;z \leq -5.2 \cdot 10^{+46}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 2.6 \cdot 10^{+113}:\\
\;\;\;\;\left(x + z \cdot y\right) + \left(a \cdot \left(z \cdot b\right) + a \cdot t\right)\\
\mathbf{elif}\;z \leq 4.6 \cdot 10^{+288}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;a \cdot t\\
\end{array}
\]
Alternative 11 Accuracy 65.8% Cost 1112
\[\begin{array}{l}
t_1 := x + a \cdot t\\
t_2 := b \cdot \left(z \cdot a\right)\\
t_3 := x + z \cdot y\\
\mathbf{if}\;y \leq -3.1 \cdot 10^{+17}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;y \leq -1.4 \cdot 10^{-98}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -5 \cdot 10^{-142}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y \leq -2.9 \cdot 10^{-252}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -8.5 \cdot 10^{-290}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y \leq 9.5 \cdot 10^{-53}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_3\\
\end{array}
\]
Alternative 12 Accuracy 71.4% Cost 1104
\[\begin{array}{l}
t_1 := z \cdot \left(y + a \cdot b\right)\\
t_2 := x + a \cdot \left(t + z \cdot b\right)\\
\mathbf{if}\;x \leq -1.4 \cdot 10^{-139}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq 4.5 \cdot 10^{-292}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 4 \cdot 10^{-244}:\\
\;\;\;\;a \cdot t + z \cdot y\\
\mathbf{elif}\;x \leq 1.9 \cdot 10^{-40}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\]
Alternative 13 Accuracy 64.7% Cost 977
\[\begin{array}{l}
t_1 := x + a \cdot t\\
\mathbf{if}\;x \leq -2.5 \cdot 10^{+37}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -9.8 \cdot 10^{-9}:\\
\;\;\;\;x + z \cdot y\\
\mathbf{elif}\;x \leq -1.55 \cdot 10^{-25} \lor \neg \left(x \leq 4.6 \cdot 10^{-40}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(y + a \cdot b\right)\\
\end{array}
\]
Alternative 14 Accuracy 84.5% Cost 972
\[\begin{array}{l}
\mathbf{if}\;y \leq -9.5 \cdot 10^{+26}:\\
\;\;\;\;\left(x + z \cdot y\right) + a \cdot \left(z \cdot b\right)\\
\mathbf{elif}\;y \leq 5.5 \cdot 10^{-53}:\\
\;\;\;\;x + a \cdot \left(t + z \cdot b\right)\\
\mathbf{elif}\;y \leq 108000000000:\\
\;\;\;\;x + z \cdot \left(y + a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x + a \cdot t\right) + z \cdot y\\
\end{array}
\]
Alternative 15 Accuracy 49.1% Cost 852
\[\begin{array}{l}
\mathbf{if}\;x \leq -47000000:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 3.4 \cdot 10^{-275}:\\
\;\;\;\;z \cdot y\\
\mathbf{elif}\;x \leq 5.1 \cdot 10^{-158}:\\
\;\;\;\;a \cdot t\\
\mathbf{elif}\;x \leq 2.55 \cdot 10^{-40}:\\
\;\;\;\;z \cdot y\\
\mathbf{elif}\;x \leq 205000000:\\
\;\;\;\;a \cdot t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\]
Alternative 16 Accuracy 47.4% Cost 848
\[\begin{array}{l}
\mathbf{if}\;x \leq -8200000:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1.55 \cdot 10^{-275}:\\
\;\;\;\;z \cdot y\\
\mathbf{elif}\;x \leq 2 \cdot 10^{-178}:\\
\;\;\;\;a \cdot t\\
\mathbf{elif}\;x \leq 1.45 \cdot 10^{-15}:\\
\;\;\;\;b \cdot \left(z \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\]
Alternative 17 Accuracy 86.9% Cost 841
\[\begin{array}{l}
\mathbf{if}\;y \leq -9.4 \cdot 10^{+24} \lor \neg \left(y \leq 0.00046\right):\\
\;\;\;\;\left(x + a \cdot t\right) + z \cdot y\\
\mathbf{else}:\\
\;\;\;\;x + a \cdot \left(t + z \cdot b\right)\\
\end{array}
\]
Alternative 18 Accuracy 86.3% Cost 841
\[\begin{array}{l}
\mathbf{if}\;a \leq -5.6 \cdot 10^{-69} \lor \neg \left(a \leq 8.5 \cdot 10^{-101}\right):\\
\;\;\;\;x + a \cdot \left(t + z \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(y + a \cdot b\right)\\
\end{array}
\]
Alternative 19 Accuracy 49.0% Cost 456
\[\begin{array}{l}
\mathbf{if}\;x \leq -1.16 \cdot 10^{-14}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 50000000:\\
\;\;\;\;a \cdot t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\]
Alternative 20 Accuracy 37.7% Cost 64
\[x
\]