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}\;b \leq -5 \cdot 10^{+74} \lor \neg \left(b \leq 2 \cdot 10^{-214}\right):\\
\;\;\;\;b \cdot \left(z \cdot a\right) + \left(t \cdot a + \left(x + y \cdot z\right)\right)\\
\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 (or (<= b -5e+74) (not (<= b 2e-214)))
(+ (* b (* z a)) (+ (* t a) (+ x (* y z))))
(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 ((b <= -5e+74) || !(b <= 2e-214)) {
tmp = (b * (z * a)) + ((t * a) + (x + (y * z)));
} 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 ((b <= -5e+74) || !(b <= 2e-214))
tmp = Float64(Float64(b * Float64(z * a)) + Float64(Float64(t * a) + Float64(x + Float64(y * z))));
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[Or[LessEqual[b, -5e+74], N[Not[LessEqual[b, 2e-214]], $MachinePrecision]], N[(N[(b * N[(z * a), $MachinePrecision]), $MachinePrecision] + N[(N[(t * a), $MachinePrecision] + N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision]), $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}\;b \leq -5 \cdot 10^{+74} \lor \neg \left(b \leq 2 \cdot 10^{-214}\right):\\
\;\;\;\;b \cdot \left(z \cdot a\right) + \left(t \cdot a + \left(x + y \cdot z\right)\right)\\
\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 98.5% Cost 13641
\[\begin{array}{l}
\mathbf{if}\;b \leq -1 \cdot 10^{-65} \lor \neg \left(b \leq 2 \cdot 10^{-214}\right):\\
\;\;\;\;b \cdot \left(z \cdot a\right) + \left(t \cdot a + \left(x + y \cdot z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, t + b \cdot z, \mathsf{fma}\left(y, z, x\right)\right)\\
\end{array}
\]
Alternative 2 Accuracy 70.2% Cost 1372
\[\begin{array}{l}
t_1 := z \cdot \left(y + b \cdot a\right)\\
t_2 := x + y \cdot z\\
t_3 := x + t \cdot a\\
\mathbf{if}\;z \leq -2.5 \cdot 10^{+151}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -3600000000:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq -2 \cdot 10^{-23}:\\
\;\;\;\;a \cdot \left(t + b \cdot z\right)\\
\mathbf{elif}\;z \leq -1.5 \cdot 10^{-63}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq 7.5 \cdot 10^{-12}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;z \leq 7.2 \cdot 10^{+79}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq 2.3 \cdot 10^{+88}:\\
\;\;\;\;t_3\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
Alternative 3 Accuracy 94.9% Cost 1225
\[\begin{array}{l}
\mathbf{if}\;a \leq 2 \cdot 10^{-174} \lor \neg \left(a \leq 10^{-125}\right):\\
\;\;\;\;\left(t \cdot a + a \cdot \left(b \cdot z\right)\right) + \left(x + y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(y + b \cdot a\right)\\
\end{array}
\]
Alternative 4 Accuracy 97.3% Cost 1225
\[\begin{array}{l}
t_1 := t \cdot a + \left(x + y \cdot z\right)\\
\mathbf{if}\;b \leq -1 \cdot 10^{-65} \lor \neg \left(b \leq 2 \cdot 10^{-214}\right):\\
\;\;\;\;b \cdot \left(z \cdot a\right) + t_1\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
Alternative 5 Accuracy 71.0% Cost 1108
\[\begin{array}{l}
t_1 := x + y \cdot z\\
t_2 := x + t \cdot a\\
t_3 := z \cdot \left(y + b \cdot a\right)\\
\mathbf{if}\;z \leq -3.5 \cdot 10^{+151}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;z \leq -2.2 \cdot 10^{-62}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 1.35 \cdot 10^{-14}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq 5.2 \cdot 10^{+77}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 5.8 \cdot 10^{+86}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_3\\
\end{array}
\]
Alternative 6 Accuracy 47.0% Cost 980
\[\begin{array}{l}
\mathbf{if}\;x \leq -2.2 \cdot 10^{+23}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 3.9 \cdot 10^{-243}:\\
\;\;\;\;t \cdot a\\
\mathbf{elif}\;x \leq 5.8 \cdot 10^{-123}:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;x \leq 1.24 \cdot 10^{+17}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 5.4 \cdot 10^{+55}:\\
\;\;\;\;z \cdot \left(b \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\]
Alternative 7 Accuracy 59.6% Cost 849
\[\begin{array}{l}
t_1 := x + t \cdot a\\
\mathbf{if}\;x \leq 5.4 \cdot 10^{-244}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 3.9 \cdot 10^{-148}:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;x \leq 1.24 \cdot 10^{+17} \lor \neg \left(x \leq 5.4 \cdot 10^{+55}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(b \cdot a\right)\\
\end{array}
\]
Alternative 8 Accuracy 68.7% Cost 849
\[\begin{array}{l}
t_1 := x + y \cdot z\\
\mathbf{if}\;z \leq -3.2 \cdot 10^{+207}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -4.5 \cdot 10^{+151}:\\
\;\;\;\;z \cdot \left(b \cdot a\right)\\
\mathbf{elif}\;z \leq -3.1 \cdot 10^{-61} \lor \neg \left(z \leq 7.4 \cdot 10^{-9}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x + t \cdot a\\
\end{array}
\]
Alternative 9 Accuracy 80.1% Cost 841
\[\begin{array}{l}
\mathbf{if}\;z \leq -5.8 \cdot 10^{-61} \lor \neg \left(z \leq 3.8 \cdot 10^{-15}\right):\\
\;\;\;\;x + z \cdot \left(y + b \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;x + t \cdot a\\
\end{array}
\]
Alternative 10 Accuracy 87.4% Cost 841
\[\begin{array}{l}
\mathbf{if}\;t \leq -7.6 \cdot 10^{-43} \lor \neg \left(t \leq 4.8 \cdot 10^{-108}\right):\\
\;\;\;\;t \cdot a + \left(x + y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(y + b \cdot a\right)\\
\end{array}
\]
Alternative 11 Accuracy 42.3% Cost 720
\[\begin{array}{l}
\mathbf{if}\;t \leq -2.4 \cdot 10^{-23}:\\
\;\;\;\;t \cdot a\\
\mathbf{elif}\;t \leq 2 \cdot 10^{-198}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 5.7 \cdot 10^{-170}:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;t \leq 8.6 \cdot 10^{-20}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t \cdot a\\
\end{array}
\]
Alternative 12 Accuracy 42.7% Cost 457
\[\begin{array}{l}
\mathbf{if}\;t \leq -2.15 \cdot 10^{-23} \lor \neg \left(t \leq 6.5 \cdot 10^{-20}\right):\\
\;\;\;\;t \cdot a\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\]
Alternative 13 Accuracy 37.8% Cost 64
\[x
\]