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 5 \cdot 10^{+16}:\\
\;\;\;\;\left(t \cdot a + \left(x + z \cdot y\right)\right) + \left(z \cdot a\right) \cdot b\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, \mathsf{fma}\left(a, b, y\right), \mathsf{fma}\left(t, a, 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 (<= z 5e+16)
(+ (+ (* t a) (+ x (* z y))) (* (* z a) b))
(fma z (fma a b y) (fma t a 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 <= 5e+16) {
tmp = ((t * a) + (x + (z * y))) + ((z * a) * b);
} else {
tmp = fma(z, fma(a, b, y), fma(t, a, 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 <= 5e+16)
tmp = Float64(Float64(Float64(t * a) + Float64(x + Float64(z * y))) + Float64(Float64(z * a) * b));
else
tmp = fma(z, fma(a, b, y), fma(t, a, 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[LessEqual[z, 5e+16], N[(N[(N[(t * a), $MachinePrecision] + N[(x + N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(z * a), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision], N[(z * N[(a * b + y), $MachinePrecision] + N[(t * a + 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 5 \cdot 10^{+16}:\\
\;\;\;\;\left(t \cdot a + \left(x + z \cdot y\right)\right) + \left(z \cdot a\right) \cdot b\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, \mathsf{fma}\left(a, b, y\right), \mathsf{fma}\left(t, a, x\right)\right)\\
\end{array}
Alternatives Alternative 1 Accuracy 96.9% Cost 19780
\[\begin{array}{l}
\mathbf{if}\;b \leq -3.05 \cdot 10^{+134}:\\
\;\;\;\;\left(t \cdot a + \left(x + z \cdot y\right)\right) + \left(z \cdot a\right) \cdot b\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, z, \mathsf{fma}\left(a, \mathsf{fma}\left(z, b, t\right), x\right)\right)\\
\end{array}
\]
Alternative 2 Accuracy 45.8% Cost 1512
\[\begin{array}{l}
\mathbf{if}\;x \leq -2.6 \cdot 10^{+119}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq -19500000000:\\
\;\;\;\;t \cdot a\\
\mathbf{elif}\;x \leq -5.4 \cdot 10^{-57}:\\
\;\;\;\;z \cdot y\\
\mathbf{elif}\;x \leq -7.6 \cdot 10^{-112}:\\
\;\;\;\;t \cdot a\\
\mathbf{elif}\;x \leq -1.8 \cdot 10^{-171}:\\
\;\;\;\;z \cdot y\\
\mathbf{elif}\;x \leq -4.6 \cdot 10^{-254}:\\
\;\;\;\;t \cdot a\\
\mathbf{elif}\;x \leq 1.95 \cdot 10^{-270}:\\
\;\;\;\;z \cdot y\\
\mathbf{elif}\;x \leq 9.2 \cdot 10^{-132}:\\
\;\;\;\;t \cdot a\\
\mathbf{elif}\;x \leq 1.2 \cdot 10^{-84}:\\
\;\;\;\;a \cdot \left(z \cdot b\right)\\
\mathbf{elif}\;x \leq 4.5 \cdot 10^{+34}:\\
\;\;\;\;t \cdot a\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\]
Alternative 3 Accuracy 45.8% Cost 1512
\[\begin{array}{l}
\mathbf{if}\;x \leq -2.6 \cdot 10^{+119}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq -540000000000:\\
\;\;\;\;t \cdot a\\
\mathbf{elif}\;x \leq -2.5 \cdot 10^{-57}:\\
\;\;\;\;z \cdot y\\
\mathbf{elif}\;x \leq -7.2 \cdot 10^{-112}:\\
\;\;\;\;t \cdot a\\
\mathbf{elif}\;x \leq -2.8 \cdot 10^{-167}:\\
\;\;\;\;z \cdot y\\
\mathbf{elif}\;x \leq -6.3 \cdot 10^{-254}:\\
\;\;\;\;t \cdot a\\
\mathbf{elif}\;x \leq 2.5 \cdot 10^{-268}:\\
\;\;\;\;z \cdot y\\
\mathbf{elif}\;x \leq 1.14 \cdot 10^{-129}:\\
\;\;\;\;t \cdot a\\
\mathbf{elif}\;x \leq 1.6 \cdot 10^{-84}:\\
\;\;\;\;\left(z \cdot a\right) \cdot b\\
\mathbf{elif}\;x \leq 2.1 \cdot 10^{+35}:\\
\;\;\;\;t \cdot a\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\]
Alternative 4 Accuracy 62.4% Cost 1504
\[\begin{array}{l}
t_1 := x + t \cdot a\\
t_2 := z \cdot \left(y + a \cdot b\right)\\
t_3 := x + z \cdot y\\
t_4 := a \cdot \left(t + z \cdot b\right)\\
\mathbf{if}\;x \leq -2.2 \cdot 10^{+122}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;x \leq -28500000000:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -3.6 \cdot 10^{-57}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;x \leq -7 \cdot 10^{-112}:\\
\;\;\;\;t_4\\
\mathbf{elif}\;x \leq -5.3 \cdot 10^{-166}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq -1.05 \cdot 10^{-253}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 1.3 \cdot 10^{-293}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq 1.28 \cdot 10^{+60}:\\
\;\;\;\;t_4\\
\mathbf{else}:\\
\;\;\;\;t_3\\
\end{array}
\]
Alternative 5 Accuracy 65.3% Cost 1504
\[\begin{array}{l}
t_1 := a \cdot \left(t + z \cdot b\right)\\
t_2 := x + t \cdot a\\
t_3 := x + z \cdot y\\
\mathbf{if}\;y \leq -3.8 \cdot 10^{+55}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;y \leq -8.5 \cdot 10^{+47}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -5.4 \cdot 10^{-8}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;y \leq -1.26 \cdot 10^{-75}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -9.5 \cdot 10^{-101}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;y \leq 9.6 \cdot 10^{-180}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y \leq 2.7 \cdot 10^{-132}:\\
\;\;\;\;x + a \cdot \left(z \cdot b\right)\\
\mathbf{elif}\;y \leq 8.5 \cdot 10^{+111}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t \cdot a + z \cdot y\\
\end{array}
\]
Alternative 6 Accuracy 46.4% Cost 1248
\[\begin{array}{l}
\mathbf{if}\;x \leq -2.6 \cdot 10^{+119}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq -16000000000:\\
\;\;\;\;t \cdot a\\
\mathbf{elif}\;x \leq -3.3 \cdot 10^{-57}:\\
\;\;\;\;z \cdot y\\
\mathbf{elif}\;x \leq -8 \cdot 10^{-112}:\\
\;\;\;\;t \cdot a\\
\mathbf{elif}\;x \leq -6.8 \cdot 10^{-170}:\\
\;\;\;\;z \cdot y\\
\mathbf{elif}\;x \leq -6.5 \cdot 10^{-254}:\\
\;\;\;\;t \cdot a\\
\mathbf{elif}\;x \leq 7 \cdot 10^{-270}:\\
\;\;\;\;z \cdot y\\
\mathbf{elif}\;x \leq 1.95 \cdot 10^{+34}:\\
\;\;\;\;t \cdot a\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\]
Alternative 7 Accuracy 65.4% Cost 1108
\[\begin{array}{l}
t_1 := t \cdot a + z \cdot y\\
t_2 := x + z \cdot y\\
\mathbf{if}\;x \leq -2.7 \cdot 10^{+119}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq -4.6 \cdot 10^{-254}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 1.05 \cdot 10^{-269}:\\
\;\;\;\;a \cdot \left(z \cdot b\right) + z \cdot y\\
\mathbf{elif}\;x \leq 9 \cdot 10^{-129}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 2.7 \cdot 10^{+60}:\\
\;\;\;\;a \cdot \left(t + z \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\]
Alternative 8 Accuracy 79.5% Cost 1105
\[\begin{array}{l}
t_1 := \left(x + t \cdot a\right) + z \cdot y\\
\mathbf{if}\;x \leq -4.8 \cdot 10^{-254}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 5.5 \cdot 10^{-270}:\\
\;\;\;\;a \cdot \left(z \cdot b\right) + z \cdot y\\
\mathbf{elif}\;x \leq 6.8 \cdot 10^{-129} \lor \neg \left(x \leq 6.6 \cdot 10^{-42}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(t + z \cdot b\right)\\
\end{array}
\]
Alternative 9 Accuracy 96.9% Cost 1092
\[\begin{array}{l}
t_1 := x + z \cdot y\\
\mathbf{if}\;b \leq -4 \cdot 10^{+135}:\\
\;\;\;\;\left(t \cdot a + t_1\right) + \left(z \cdot a\right) \cdot b\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(t + z \cdot b\right) + t_1\\
\end{array}
\]
Alternative 10 Accuracy 87.4% Cost 968
\[\begin{array}{l}
\mathbf{if}\;x \leq -1.9 \cdot 10^{-99}:\\
\;\;\;\;t \cdot a + \left(x + z \cdot y\right)\\
\mathbf{elif}\;x \leq 2.3 \cdot 10^{-6}:\\
\;\;\;\;z \cdot \left(y + a \cdot b\right) + t \cdot a\\
\mathbf{else}:\\
\;\;\;\;\left(x + t \cdot a\right) + z \cdot y\\
\end{array}
\]
Alternative 11 Accuracy 85.1% Cost 968
\[\begin{array}{l}
t_1 := x + z \cdot y\\
\mathbf{if}\;x \leq -6.1 \cdot 10^{-96}:\\
\;\;\;\;t \cdot a + t_1\\
\mathbf{elif}\;x \leq 0.82:\\
\;\;\;\;z \cdot \left(y + a \cdot b\right) + t \cdot a\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(z \cdot b\right) + t_1\\
\end{array}
\]
Alternative 12 Accuracy 67.9% Cost 849
\[\begin{array}{l}
t_1 := x + t \cdot a\\
\mathbf{if}\;a \leq -4.5 \cdot 10^{-76}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;a \leq -1.3 \cdot 10^{-96}:\\
\;\;\;\;z \cdot \left(y + a \cdot b\right)\\
\mathbf{elif}\;a \leq -1.65 \cdot 10^{-139} \lor \neg \left(a \leq 3.8 \cdot 10^{-92}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot y\\
\end{array}
\]
Alternative 13 Accuracy 87.6% Cost 841
\[\begin{array}{l}
\mathbf{if}\;t \leq -4.6 \cdot 10^{-151} \lor \neg \left(t \leq 2.05 \cdot 10^{-128}\right):\\
\;\;\;\;\left(x + t \cdot a\right) + z \cdot y\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(y + a \cdot b\right)\\
\end{array}
\]
Alternative 14 Accuracy 87.6% Cost 840
\[\begin{array}{l}
\mathbf{if}\;t \leq -4.6 \cdot 10^{-151}:\\
\;\;\;\;\left(x + t \cdot a\right) + z \cdot y\\
\mathbf{elif}\;t \leq 2.25 \cdot 10^{-128}:\\
\;\;\;\;x + z \cdot \left(y + a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;t \cdot a + \left(x + z \cdot y\right)\\
\end{array}
\]
Alternative 15 Accuracy 95.4% Cost 832
\[a \cdot \left(t + z \cdot b\right) + \left(x + z \cdot y\right)
\]
Alternative 16 Accuracy 61.1% Cost 588
\[\begin{array}{l}
\mathbf{if}\;y \leq -2.7 \cdot 10^{+141}:\\
\;\;\;\;z \cdot y\\
\mathbf{elif}\;y \leq 5.9 \cdot 10^{+128}:\\
\;\;\;\;x + t \cdot a\\
\mathbf{elif}\;y \leq 1.4 \cdot 10^{+288}:\\
\;\;\;\;z \cdot y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\]
Alternative 17 Accuracy 68.7% Cost 585
\[\begin{array}{l}
\mathbf{if}\;a \leq -3.2 \cdot 10^{-73} \lor \neg \left(a \leq 9.4 \cdot 10^{-94}\right):\\
\;\;\;\;x + t \cdot a\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot y\\
\end{array}
\]
Alternative 18 Accuracy 46.2% Cost 456
\[\begin{array}{l}
\mathbf{if}\;x \leq -2.6 \cdot 10^{+119}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1.06 \cdot 10^{+30}:\\
\;\;\;\;t \cdot a\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\]
Alternative 19 Accuracy 37.0% Cost 64
\[x
\]