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(a, b, \mathsf{fma}\left(c, i, \mathsf{fma}\left(x, y, 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 a b (fma c i (fma x y (* 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(a, b, fma(c, i, fma(x, y, (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(a, b, fma(c, i, fma(x, y, 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[(a * b + N[(c * i + N[(x * y + 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(a, b, \mathsf{fma}\left(c, i, \mathsf{fma}\left(x, y, z \cdot t\right)\right)\right)
Alternatives Alternative 1 Error 0.0 Cost 7232
\[\mathsf{fma}\left(x, y, z \cdot t\right) + \left(a \cdot b + c \cdot i\right)
\]
Alternative 2 Error 38.2 Cost 3052
\[\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -1.56 \cdot 10^{+44}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;a \cdot b \leq -8 \cdot 10^{+29}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;a \cdot b \leq -5.4 \cdot 10^{+18}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;a \cdot b \leq -2.2 \cdot 10^{-53}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;a \cdot b \leq -8.2 \cdot 10^{-58}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;a \cdot b \leq -7.2 \cdot 10^{-100}:\\
\;\;\;\;c \cdot i\\
\mathbf{elif}\;a \cdot b \leq 1.6 \cdot 10^{-191}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;a \cdot b \leq 8.4 \cdot 10^{-42}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;a \cdot b \leq 2.7 \cdot 10^{+19}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;a \cdot b \leq 3.9 \cdot 10^{+68}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;a \cdot b \leq 1.2 \cdot 10^{+128}:\\
\;\;\;\;c \cdot i\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
\]
Alternative 3 Error 21.9 Cost 2528
\[\begin{array}{l}
t_1 := a \cdot b + z \cdot t\\
t_2 := a \cdot b + x \cdot y\\
t_3 := a \cdot b + c \cdot i\\
\mathbf{if}\;c \cdot i \leq -9.5 \cdot 10^{+85}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;c \cdot i \leq -1.7 \cdot 10^{-75}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \cdot i \leq -4 \cdot 10^{-320}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;c \cdot i \leq 8.6 \cdot 10^{-247}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \cdot i \leq 9 \cdot 10^{-120}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;c \cdot i \leq 2.1 \cdot 10^{+40}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \cdot i \leq 3 \cdot 10^{+87}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;c \cdot i \leq 3.35 \cdot 10^{+87}:\\
\;\;\;\;z \cdot t\\
\mathbf{else}:\\
\;\;\;\;t_3\\
\end{array}
\]
Alternative 4 Error 22.4 Cost 2528
\[\begin{array}{l}
t_1 := a \cdot b + x \cdot y\\
t_2 := a \cdot b + z \cdot t\\
t_3 := z \cdot t + x \cdot y\\
t_4 := c \cdot i + x \cdot y\\
\mathbf{if}\;c \cdot i \leq -3.85 \cdot 10^{+173}:\\
\;\;\;\;t_4\\
\mathbf{elif}\;c \cdot i \leq -1.25 \cdot 10^{+89}:\\
\;\;\;\;a \cdot b + c \cdot i\\
\mathbf{elif}\;c \cdot i \leq -1.6 \cdot 10^{-169}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;c \cdot i \leq -4 \cdot 10^{-320}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \cdot i \leq 4.9 \cdot 10^{-247}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;c \cdot i \leq 1.05 \cdot 10^{-120}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \cdot i \leq 140:\\
\;\;\;\;t_3\\
\mathbf{elif}\;c \cdot i \leq 2.7 \cdot 10^{+41}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_4\\
\end{array}
\]
Alternative 5 Error 27.1 Cost 2164
\[\begin{array}{l}
t_1 := c \cdot i + z \cdot t\\
t_2 := a \cdot b + x \cdot y\\
\mathbf{if}\;x \leq -1.7 \cdot 10^{+124}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq -5 \cdot 10^{+110}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -1.1 \cdot 10^{+89}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;x \leq -2.1 \cdot 10^{+37}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -1.5 \cdot 10^{-8}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq -7 \cdot 10^{-24}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -2.5 \cdot 10^{-37}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq -1.6 \cdot 10^{-74}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -1.7 \cdot 10^{-103}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq -8.5 \cdot 10^{-248}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 1.55 \cdot 10^{-187}:\\
\;\;\;\;a \cdot b + c \cdot i\\
\mathbf{elif}\;x \leq 8.5 \cdot 10^{-148}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\mathbf{elif}\;x \leq 3 \cdot 10^{-100}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\]
Alternative 6 Error 27.0 Cost 2032
\[\begin{array}{l}
t_1 := c \cdot i + z \cdot t\\
t_2 := a \cdot b + x \cdot y\\
t_3 := c \cdot i + x \cdot y\\
\mathbf{if}\;x \leq -7 \cdot 10^{+124}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq -1.56 \cdot 10^{+109}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -2.22 \cdot 10^{+83}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;x \leq -1.32 \cdot 10^{+37}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -1.48 \cdot 10^{-8}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq -3.1 \cdot 10^{-24}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -2 \cdot 10^{-36}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq -1.5 \cdot 10^{-73}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -1.4 \cdot 10^{-102}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq -5 \cdot 10^{-250}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 5.2 \cdot 10^{-186}:\\
\;\;\;\;a \cdot b + c \cdot i\\
\mathbf{elif}\;x \leq 4.4 \cdot 10^{-108}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;t_3\\
\end{array}
\]
Alternative 7 Error 37.9 Cost 1752
\[\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -4.8 \cdot 10^{+88}:\\
\;\;\;\;c \cdot i\\
\mathbf{elif}\;c \cdot i \leq -2.4 \cdot 10^{-172}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;c \cdot i \leq -5 \cdot 10^{-324}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;c \cdot i \leq 3000000000000:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;c \cdot i \leq 3.6 \cdot 10^{+39}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;c \cdot i \leq 6 \cdot 10^{+46}:\\
\;\;\;\;z \cdot t\\
\mathbf{else}:\\
\;\;\;\;c \cdot i\\
\end{array}
\]
Alternative 8 Error 15.2 Cost 1629
\[\begin{array}{l}
t_1 := z \cdot t + x \cdot y\\
t_2 := a \cdot b + \left(c \cdot i + z \cdot t\right)\\
\mathbf{if}\;y \leq -1.46 \cdot 10^{-6}:\\
\;\;\;\;a \cdot b + x \cdot y\\
\mathbf{elif}\;y \leq 1.2 \cdot 10^{+60}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y \leq 1.95 \cdot 10^{+77}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 1.9 \cdot 10^{+121}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y \leq 1.18 \cdot 10^{+144}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 1.6 \cdot 10^{+175} \lor \neg \left(y \leq 8.5 \cdot 10^{+229}\right):\\
\;\;\;\;c \cdot i + x \cdot y\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\]
Alternative 9 Error 31.3 Cost 1505
\[\begin{array}{l}
t_1 := a \cdot b + c \cdot i\\
\mathbf{if}\;t \leq -2.4 \cdot 10^{-25}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;t \leq 3.6 \cdot 10^{-135}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 7.2 \cdot 10^{-91}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;t \leq 82000000000000:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 2.7 \cdot 10^{+38}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;t \leq 5.8 \cdot 10^{+125}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 1.65 \cdot 10^{+186} \lor \neg \left(t \leq 1.45 \cdot 10^{+217}\right):\\
\;\;\;\;a \cdot b + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}
\]
Alternative 10 Error 32.3 Cost 1504
\[\begin{array}{l}
t_1 := a \cdot b + c \cdot i\\
\mathbf{if}\;t \leq -1.85 \cdot 10^{-25}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;t \leq 1.7 \cdot 10^{-135}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 1.65 \cdot 10^{-93}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;t \leq 85000000000000:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 3.1 \cdot 10^{+38}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;t \leq 6 \cdot 10^{+125}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 1.92 \cdot 10^{+180}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;t \leq 3.8 \cdot 10^{+185}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 1.35 \cdot 10^{+217}:\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;z \cdot t\\
\end{array}
\]
Alternative 11 Error 7.6 Cost 1224
\[\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -5.9 \cdot 10^{+85}:\\
\;\;\;\;a \cdot b + \left(c \cdot i + z \cdot t\right)\\
\mathbf{elif}\;c \cdot i \leq 6.8 \cdot 10^{+92}:\\
\;\;\;\;a \cdot b + \left(z \cdot t + x \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;c \cdot i + x \cdot y\\
\end{array}
\]
Alternative 12 Error 0.0 Cost 960
\[c \cdot i + \left(a \cdot b + \left(z \cdot t + x \cdot y\right)\right)
\]
Alternative 13 Error 37.2 Cost 712
\[\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -1.2 \cdot 10^{+39}:\\
\;\;\;\;c \cdot i\\
\mathbf{elif}\;c \cdot i \leq 4.3 \cdot 10^{+46}:\\
\;\;\;\;a \cdot b\\
\mathbf{else}:\\
\;\;\;\;c \cdot i\\
\end{array}
\]
Alternative 14 Error 46.8 Cost 192
\[a \cdot b
\]