Math FPCore C Julia Wolfram TeX \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i
\]
↓
\[\mathsf{fma}\left(x, y, \mathsf{fma}\left(c, i, \mathsf{fma}\left(a, b, z \cdot t\right)\right)\right)
\]
(FPCore (x y z t a b c i)
:precision binary64
(+ (+ (+ (* x y) (* z t)) (* a b)) (* c i))) ↓
(FPCore (x y z t a b c i)
:precision binary64
(fma x y (fma c i (fma a b (* z t))))) double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return (((x * y) + (z * t)) + (a * b)) + (c * i);
}
↓
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return fma(x, y, fma(c, i, fma(a, b, (z * t))));
}
function code(x, y, z, t, a, b, c, i)
return Float64(Float64(Float64(Float64(x * y) + Float64(z * t)) + Float64(a * b)) + Float64(c * i))
end
↓
function code(x, y, z, t, a, b, c, i)
return fma(x, y, fma(c, i, fma(a, b, Float64(z * t))))
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]
↓
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(x * y + N[(c * i + N[(a * b + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i
↓
\mathsf{fma}\left(x, y, \mathsf{fma}\left(c, i, \mathsf{fma}\left(a, b, z \cdot t\right)\right)\right)
Alternatives Alternative 1 Error 0.04% Cost 7232
\[\left(a \cdot b + c \cdot i\right) + \mathsf{fma}\left(x, y, z \cdot t\right)
\]
Alternative 2 Error 0.04% Cost 7232
\[\mathsf{fma}\left(z, t, x \cdot y\right) + \left(a \cdot b + c \cdot i\right)
\]
Alternative 3 Error 42.27% Cost 2560
\[\begin{array}{l}
t_1 := a \cdot b + z \cdot t\\
t_2 := x \cdot y + a \cdot b\\
t_3 := c \cdot i + z \cdot t\\
t_4 := x \cdot y + c \cdot i\\
t_5 := x \cdot y + z \cdot t\\
\mathbf{if}\;i \leq -9 \cdot 10^{-74}:\\
\;\;\;\;t_4\\
\mathbf{elif}\;i \leq -8.4 \cdot 10^{-139}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;i \leq -3.15 \cdot 10^{-198}:\\
\;\;\;\;t_5\\
\mathbf{elif}\;i \leq 1.95 \cdot 10^{-304}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;i \leq 3 \cdot 10^{-183}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;i \leq 5 \cdot 10^{-174}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;i \leq 1.95 \cdot 10^{-83}:\\
\;\;\;\;t_5\\
\mathbf{elif}\;i \leq 1.95 \cdot 10^{-34}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;i \leq 0.34:\\
\;\;\;\;t_4\\
\mathbf{elif}\;i \leq 8.5 \cdot 10^{+24}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;i \leq 5.6 \cdot 10^{+33}:\\
\;\;\;\;t_5\\
\mathbf{elif}\;i \leq 1.55 \cdot 10^{+87}:\\
\;\;\;\;a \cdot b + c \cdot i\\
\mathbf{elif}\;i \leq 2.75 \cdot 10^{+134}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;i \leq 9.5 \cdot 10^{+152}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;i \leq 2.05 \cdot 10^{+189}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;i \leq 2.1 \cdot 10^{+208}:\\
\;\;\;\;t_5\\
\mathbf{else}:\\
\;\;\;\;t_4\\
\end{array}
\]
Alternative 4 Error 34.88% Cost 2268
\[\begin{array}{l}
t_1 := x \cdot y + a \cdot b\\
t_2 := a \cdot b + z \cdot t\\
t_3 := a \cdot b + c \cdot i\\
\mathbf{if}\;c \cdot i \leq -6.8 \cdot 10^{+74}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;c \cdot i \leq -3.1 \cdot 10^{-131}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \cdot i \leq -1.6 \cdot 10^{-168}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;c \cdot i \leq -1 \cdot 10^{-315}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \cdot i \leq 2.7 \cdot 10^{-36}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;c \cdot i \leq 3.1 \cdot 10^{-5}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \cdot i \leq 2.5 \cdot 10^{+51}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_3\\
\end{array}
\]
Alternative 5 Error 34.92% Cost 2268
\[\begin{array}{l}
t_1 := x \cdot y + a \cdot b\\
t_2 := c \cdot i + z \cdot t\\
t_3 := a \cdot b + z \cdot t\\
\mathbf{if}\;c \cdot i \leq -4.5 \cdot 10^{+75}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;c \cdot i \leq -3.4 \cdot 10^{-131}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \cdot i \leq -7.2 \cdot 10^{-169}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;c \cdot i \leq -1 \cdot 10^{-315}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \cdot i \leq 1.65 \cdot 10^{-32}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;c \cdot i \leq 3.1 \cdot 10^{-6}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \cdot i \leq 5.8 \cdot 10^{+65}:\\
\;\;\;\;t_3\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\]
Alternative 6 Error 42.49% Cost 2032
\[\begin{array}{l}
t_1 := c \cdot i + z \cdot t\\
t_2 := a \cdot b + z \cdot t\\
t_3 := x \cdot y + c \cdot i\\
t_4 := x \cdot y + a \cdot b\\
\mathbf{if}\;i \leq -4.4 \cdot 10^{-63}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;i \leq 1.02 \cdot 10^{-304}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;i \leq 7.2 \cdot 10^{-188}:\\
\;\;\;\;t_4\\
\mathbf{elif}\;i \leq 1.25 \cdot 10^{-127}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;i \leq 3.8 \cdot 10^{-53}:\\
\;\;\;\;t_4\\
\mathbf{elif}\;i \leq 4.2 \cdot 10^{-34}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;i \leq 0.3:\\
\;\;\;\;t_3\\
\mathbf{elif}\;i \leq 1.65 \cdot 10^{+25}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;i \leq 3 \cdot 10^{+37}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;i \leq 4.3 \cdot 10^{+163}:\\
\;\;\;\;a \cdot b + c \cdot i\\
\mathbf{elif}\;i \leq 2.8 \cdot 10^{+208}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;i \leq 2.35 \cdot 10^{+265}:\\
\;\;\;\;t_3\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
Alternative 7 Error 58.47% Cost 1752
\[\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -1.02 \cdot 10^{+73}:\\
\;\;\;\;c \cdot i\\
\mathbf{elif}\;c \cdot i \leq -4.4 \cdot 10^{-143}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;c \cdot i \leq 1.42 \cdot 10^{-182}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;c \cdot i \leq 1.4 \cdot 10^{-25}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;c \cdot i \leq 4.5 \cdot 10^{-7}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;c \cdot i \leq 2.8 \cdot 10^{+46}:\\
\;\;\;\;z \cdot t\\
\mathbf{else}:\\
\;\;\;\;c \cdot i\\
\end{array}
\]
Alternative 8 Error 37.12% Cost 1748
\[\begin{array}{l}
t_1 := a \cdot b + z \cdot t\\
t_2 := a \cdot b + c \cdot i\\
\mathbf{if}\;c \cdot i \leq -8.5 \cdot 10^{+72}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;c \cdot i \leq -1.85 \cdot 10^{-23}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;c \cdot i \leq 1.25 \cdot 10^{-24}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \cdot i \leq 10^{-7}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;c \cdot i \leq 1.12 \cdot 10^{+52}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\]
Alternative 9 Error 58.46% Cost 1232
\[\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -0.05:\\
\;\;\;\;c \cdot i\\
\mathbf{elif}\;c \cdot i \leq -2.4 \cdot 10^{-145}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;c \cdot i \leq 3.6 \cdot 10^{-180}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;c \cdot i \leq 3.3 \cdot 10^{+46}:\\
\;\;\;\;z \cdot t\\
\mathbf{else}:\\
\;\;\;\;c \cdot i\\
\end{array}
\]
Alternative 10 Error 13.75% Cost 1225
\[\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -1.5 \cdot 10^{+58} \lor \neg \left(c \cdot i \leq 2.2 \cdot 10^{+67}\right):\\
\;\;\;\;x \cdot y + c \cdot i\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + \left(x \cdot y + z \cdot t\right)\\
\end{array}
\]
Alternative 11 Error 9.6% Cost 1225
\[\begin{array}{l}
t_1 := x \cdot y + z \cdot t\\
\mathbf{if}\;c \cdot i \leq -6.5 \cdot 10^{+57} \lor \neg \left(c \cdot i \leq 3.5 \cdot 10^{+66}\right):\\
\;\;\;\;c \cdot i + t_1\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + t_1\\
\end{array}
\]
Alternative 12 Error 0.04% Cost 960
\[c \cdot i + \left(a \cdot b + \left(x \cdot y + z \cdot t\right)\right)
\]
Alternative 13 Error 58.96% Cost 712
\[\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -4.8 \cdot 10^{-16}:\\
\;\;\;\;c \cdot i\\
\mathbf{elif}\;c \cdot i \leq 1.9 \cdot 10^{+39}:\\
\;\;\;\;a \cdot b\\
\mathbf{else}:\\
\;\;\;\;c \cdot i\\
\end{array}
\]
Alternative 14 Error 49.05% Cost 712
\[\begin{array}{l}
\mathbf{if}\;z \leq -1.8 \cdot 10^{+104}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;z \leq 0.00014:\\
\;\;\;\;a \cdot b + c \cdot i\\
\mathbf{else}:\\
\;\;\;\;z \cdot t\\
\end{array}
\]
Alternative 15 Error 73.5% Cost 192
\[a \cdot b
\]