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 -1 \cdot 10^{+84} \lor \neg \left(b \leq 10000\right):\\
\;\;\;\;\left(t \cdot a + \left(x + y \cdot z\right)\right) + b \cdot \left(z \cdot a\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 -1e+84) (not (<= b 10000.0)))
(+ (+ (* t a) (+ x (* y z))) (* b (* z a)))
(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 <= -1e+84) || !(b <= 10000.0)) {
tmp = ((t * a) + (x + (y * z))) + (b * (z * a));
} 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 <= -1e+84) || !(b <= 10000.0))
tmp = Float64(Float64(Float64(t * a) + Float64(x + Float64(y * z))) + Float64(b * Float64(z * a)));
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, -1e+84], N[Not[LessEqual[b, 10000.0]], $MachinePrecision]], N[(N[(N[(t * a), $MachinePrecision] + N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(b * N[(z * a), $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 -1 \cdot 10^{+84} \lor \neg \left(b \leq 10000\right):\\
\;\;\;\;\left(t \cdot a + \left(x + y \cdot z\right)\right) + b \cdot \left(z \cdot a\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 Error 0.51% Cost 13641
\[\begin{array}{l}
\mathbf{if}\;b \leq -5 \cdot 10^{-36} \lor \neg \left(b \leq 5 \cdot 10^{+70}\right):\\
\;\;\;\;\left(t \cdot a + \left(x + y \cdot z\right)\right) + b \cdot \left(z \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, t + b \cdot z, \mathsf{fma}\left(y, z, x\right)\right)\\
\end{array}
\]
Alternative 2 Error 32.11% Cost 1373
\[\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 -8.6 \cdot 10^{+211}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;z \leq -8.5 \cdot 10^{-151}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 1.8 \cdot 10^{-25}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq 8.6 \cdot 10^{+21}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 2.7 \cdot 10^{+126}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq 2.1 \cdot 10^{+171} \lor \neg \left(z \leq 1.76 \cdot 10^{+270}\right):\\
\;\;\;\;t_3\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
Alternative 3 Error 24.35% Cost 1373
\[\begin{array}{l}
t_1 := x + y \cdot z\\
t_2 := x + a \cdot \left(t + b \cdot z\right)\\
t_3 := z \cdot \left(y + b \cdot a\right)\\
\mathbf{if}\;z \leq -5.2 \cdot 10^{+211}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;z \leq -5.3 \cdot 10^{-64}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 2.15 \cdot 10^{-11}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq 8.2 \cdot 10^{+20}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 4.2 \cdot 10^{+124}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq 3.6 \cdot 10^{+171} \lor \neg \left(z \leq 8.1 \cdot 10^{+245}\right):\\
\;\;\;\;t_3\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
Alternative 4 Error 5.2% Cost 1225
\[\begin{array}{l}
\mathbf{if}\;y \leq -5 \cdot 10^{-216} \lor \neg \left(y \leq 10^{-179}\right):\\
\;\;\;\;\left(t \cdot a + a \cdot \left(b \cdot z\right)\right) + \left(x + y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;b \cdot \left(z \cdot a\right) + \left(x + t \cdot a\right)\\
\end{array}
\]
Alternative 5 Error 0.51% Cost 1225
\[\begin{array}{l}
t_1 := x + y \cdot z\\
\mathbf{if}\;b \leq -5 \cdot 10^{-36} \lor \neg \left(b \leq 5 \cdot 10^{+70}\right):\\
\;\;\;\;\left(t \cdot a + t_1\right) + b \cdot \left(z \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t \cdot a + a \cdot \left(b \cdot z\right)\right) + t_1\\
\end{array}
\]
Alternative 6 Error 12.06% Cost 969
\[\begin{array}{l}
t_1 := x + t \cdot a\\
\mathbf{if}\;y \leq -6.6 \cdot 10^{-71} \lor \neg \left(y \leq 2.7 \cdot 10^{-24}\right):\\
\;\;\;\;y \cdot z + t_1\\
\mathbf{else}:\\
\;\;\;\;b \cdot \left(z \cdot a\right) + t_1\\
\end{array}
\]
Alternative 7 Error 12.34% Cost 841
\[\begin{array}{l}
\mathbf{if}\;y \leq -6.8 \cdot 10^{-71} \lor \neg \left(y \leq 3.1 \cdot 10^{-24}\right):\\
\;\;\;\;y \cdot z + \left(x + t \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;x + a \cdot \left(t + b \cdot z\right)\\
\end{array}
\]
Alternative 8 Error 52.7% Cost 720
\[\begin{array}{l}
\mathbf{if}\;x \leq -1.56 \cdot 10^{+62}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq -1.52 \cdot 10^{-131}:\\
\;\;\;\;t \cdot a\\
\mathbf{elif}\;x \leq 2.5 \cdot 10^{-291}:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;x \leq 2 \cdot 10^{+55}:\\
\;\;\;\;t \cdot a\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\]
Alternative 9 Error 32% Cost 585
\[\begin{array}{l}
\mathbf{if}\;y \leq -2.6 \cdot 10^{+68} \lor \neg \left(y \leq 4.5 \cdot 10^{+29}\right):\\
\;\;\;\;x + y \cdot z\\
\mathbf{else}:\\
\;\;\;\;x + t \cdot a\\
\end{array}
\]
Alternative 10 Error 40.89% Cost 584
\[\begin{array}{l}
\mathbf{if}\;y \leq -8.8 \cdot 10^{+226}:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;y \leq 9 \cdot 10^{+29}:\\
\;\;\;\;x + t \cdot a\\
\mathbf{else}:\\
\;\;\;\;y \cdot z\\
\end{array}
\]
Alternative 11 Error 52.79% Cost 456
\[\begin{array}{l}
\mathbf{if}\;x \leq -6 \cdot 10^{+63}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 2.5 \cdot 10^{+53}:\\
\;\;\;\;t \cdot a\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\]
Alternative 12 Error 62.33% Cost 64
\[x
\]