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.0 Cost 19776
\[\mathsf{fma}\left(a, b, \mathsf{fma}\left(c, i, \mathsf{fma}\left(x, y, z \cdot t\right)\right)\right)
\]
Alternative 2 Error 38.2 Cost 2532
\[\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -8.8 \cdot 10^{+46}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;a \cdot b \leq -3200000000:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;a \cdot b \leq -4.6 \cdot 10^{-29}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;a \cdot b \leq -5.8 \cdot 10^{-152}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;a \cdot b \leq 0:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;a \cdot b \leq 2.35 \cdot 10^{-247}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;a \cdot b \leq 580:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;a \cdot b \leq 3.7 \cdot 10^{+36}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;a \cdot b \leq 2.35 \cdot 10^{+75}:\\
\;\;\;\;z \cdot t\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
\]
Alternative 3 Error 25.2 Cost 2268
\[\begin{array}{l}
t_1 := a \cdot b + x \cdot y\\
t_2 := a \cdot b + z \cdot t\\
\mathbf{if}\;c \cdot i \leq -1.6 \cdot 10^{+111}:\\
\;\;\;\;c \cdot i\\
\mathbf{elif}\;c \cdot i \leq -5.3 \cdot 10^{-20}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \cdot i \leq -1.3 \cdot 10^{-98}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;c \cdot i \leq 3.8 \cdot 10^{-224}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \cdot i \leq 3.3 \cdot 10^{-126}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;c \cdot i \leq 7.5 \cdot 10^{-94}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \cdot i \leq 9.2 \cdot 10^{+74}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;c \cdot i\\
\end{array}
\]
Alternative 4 Error 23.1 Cost 2268
\[\begin{array}{l}
t_1 := a \cdot b + x \cdot y\\
t_2 := a \cdot b + z \cdot t\\
t_3 := c \cdot i + a \cdot b\\
\mathbf{if}\;c \cdot i \leq -1.4 \cdot 10^{+111}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;c \cdot i \leq -4.2 \cdot 10^{-19}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \cdot i \leq -8.5 \cdot 10^{-99}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;c \cdot i \leq 3.2 \cdot 10^{-224}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \cdot i \leq 7.6 \cdot 10^{-126}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;c \cdot i \leq 5.5 \cdot 10^{-94}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \cdot i \leq 4.4 \cdot 10^{+38}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_3\\
\end{array}
\]
Alternative 5 Error 23.3 Cost 2268
\[\begin{array}{l}
t_1 := a \cdot b + x \cdot y\\
t_2 := a \cdot b + z \cdot t\\
t_3 := c \cdot i + a \cdot b\\
\mathbf{if}\;c \cdot i \leq -1.4 \cdot 10^{+111}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;c \cdot i \leq -6 \cdot 10^{-67}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \cdot i \leq -1.9 \cdot 10^{-98}:\\
\;\;\;\;c \cdot i + z \cdot t\\
\mathbf{elif}\;c \cdot i \leq 1.55 \cdot 10^{-223}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \cdot i \leq 4.6 \cdot 10^{-126}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;c \cdot i \leq 4.1 \cdot 10^{-94}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \cdot i \leq 4.5 \cdot 10^{+38}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_3\\
\end{array}
\]
Alternative 6 Error 38.1 Cost 2012
\[\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -2.55 \cdot 10^{+33}:\\
\;\;\;\;c \cdot i\\
\mathbf{elif}\;c \cdot i \leq -2.2 \cdot 10^{-55}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;c \cdot i \leq -1.02 \cdot 10^{-88}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;c \cdot i \leq 8.4 \cdot 10^{-94}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;c \cdot i \leq 6.2 \cdot 10^{-25}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;c \cdot i \leq 4 \cdot 10^{+20}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;c \cdot i \leq 2.95 \cdot 10^{+41}:\\
\;\;\;\;z \cdot t\\
\mathbf{else}:\\
\;\;\;\;c \cdot i\\
\end{array}
\]
Alternative 7 Error 27.1 Cost 1504
\[\begin{array}{l}
t_1 := a \cdot b + x \cdot y\\
t_2 := c \cdot i + z \cdot t\\
t_3 := c \cdot i + a \cdot b\\
\mathbf{if}\;a \leq -2 \cdot 10^{+204}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;a \leq -1.05 \cdot 10^{+113}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\mathbf{elif}\;a \leq -7.5 \cdot 10^{+32}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;a \leq -2.65 \cdot 10^{-45}:\\
\;\;\;\;x \cdot y + z \cdot t\\
\mathbf{elif}\;a \leq -4.2 \cdot 10^{-81}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;a \leq -1.8 \cdot 10^{-204}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;a \leq 4 \cdot 10^{-264}:\\
\;\;\;\;c \cdot i + x \cdot y\\
\mathbf{elif}\;a \leq 1.12 \cdot 10^{-148}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
Alternative 8 Error 25.7 Cost 1488
\[\begin{array}{l}
t_1 := a \cdot b + z \cdot t\\
\mathbf{if}\;c \cdot i \leq -2.05 \cdot 10^{+58}:\\
\;\;\;\;c \cdot i\\
\mathbf{elif}\;c \cdot i \leq -9.6 \cdot 10^{-229}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \cdot i \leq -2.75 \cdot 10^{-289}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;c \cdot i \leq 8.5 \cdot 10^{+74}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;c \cdot i\\
\end{array}
\]
Alternative 9 Error 8.9 Cost 1225
\[\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -4.6 \cdot 10^{+124} \lor \neg \left(c \cdot i \leq 1.6 \cdot 10^{+74}\right):\\
\;\;\;\;c \cdot i + a \cdot b\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + \left(x \cdot y + z \cdot t\right)\\
\end{array}
\]
Alternative 10 Error 8.9 Cost 1225
\[\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -1 \cdot 10^{+124} \lor \neg \left(c \cdot i \leq 6.8 \cdot 10^{+73}\right):\\
\;\;\;\;c \cdot i + a \cdot b\\
\mathbf{else}:\\
\;\;\;\;x \cdot y + \left(a \cdot b + z \cdot t\right)\\
\end{array}
\]
Alternative 11 Error 7.4 Cost 1225
\[\begin{array}{l}
t_1 := a \cdot b + z \cdot t\\
\mathbf{if}\;c \cdot i \leq -1.4 \cdot 10^{+111} \lor \neg \left(c \cdot i \leq 5 \cdot 10^{-34}\right):\\
\;\;\;\;c \cdot i + t_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot y + t_1\\
\end{array}
\]
Alternative 12 Error 6.4 Cost 1225
\[\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -1 \cdot 10^{+97} \lor \neg \left(z \cdot t \leq 2 \cdot 10^{+30}\right):\\
\;\;\;\;a \cdot b + \left(x \cdot y + z \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;c \cdot i + \left(a \cdot b + x \cdot y\right)\\
\end{array}
\]
Alternative 13 Error 0.0 Cost 960
\[\left(\left(c \cdot i + a \cdot b\right) + z \cdot t\right) + x \cdot y
\]
Alternative 14 Error 38.1 Cost 712
\[\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -7.4 \cdot 10^{+40}:\\
\;\;\;\;c \cdot i\\
\mathbf{elif}\;c \cdot i \leq 1.26 \cdot 10^{+14}:\\
\;\;\;\;a \cdot b\\
\mathbf{else}:\\
\;\;\;\;c \cdot i\\
\end{array}
\]
Alternative 15 Error 47.6 Cost 192
\[a \cdot b
\]