Math FPCore C Julia Wolfram TeX \[\left(x \cdot y + z \cdot t\right) + a \cdot b
\]
↓
\[\mathsf{fma}\left(z, t, \mathsf{fma}\left(x, y, a \cdot b\right)\right)
\]
(FPCore (x y z t a b) :precision binary64 (+ (+ (* x y) (* z t)) (* a b))) ↓
(FPCore (x y z t a b) :precision binary64 (fma z t (fma x y (* a b)))) double code(double x, double y, double z, double t, double a, double b) {
return ((x * y) + (z * t)) + (a * b);
}
↓
double code(double x, double y, double z, double t, double a, double b) {
return fma(z, t, fma(x, y, (a * b)));
}
function code(x, y, z, t, a, b)
return Float64(Float64(Float64(x * y) + Float64(z * t)) + Float64(a * b))
end
↓
function code(x, y, z, t, a, b)
return fma(z, t, fma(x, y, Float64(a * b)))
end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision]
↓
code[x_, y_, z_, t_, a_, b_] := N[(z * t + N[(x * y + N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(x \cdot y + z \cdot t\right) + a \cdot b
↓
\mathsf{fma}\left(z, t, \mathsf{fma}\left(x, y, a \cdot b\right)\right)
Alternatives Alternative 1 Error 0.0 Cost 6976
\[a \cdot b + \mathsf{fma}\left(z, t, x \cdot y\right)
\]
Alternative 2 Error 30.3 Cost 1492
\[\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -1.0343818289721886 \cdot 10^{+40}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;a \cdot b \leq -5.863064413199493 \cdot 10^{-74}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;a \cdot b \leq 0:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;a \cdot b \leq 3.0857381932457447 \cdot 10^{-211}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;a \cdot b \leq 0.027713940983546258:\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
\]
Alternative 3 Error 20.7 Cost 976
\[\begin{array}{l}
t_1 := a \cdot b + x \cdot y\\
\mathbf{if}\;t \leq -5.718962599885292 \cdot 10^{-46}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;t \leq 2.1 \cdot 10^{+86}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 5.1 \cdot 10^{+174}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;t \leq 1.25 \cdot 10^{+231}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;z \cdot t\\
\end{array}
\]
Alternative 4 Error 14.3 Cost 976
\[\begin{array}{l}
t_1 := a \cdot b + x \cdot y\\
t_2 := a \cdot b + z \cdot t\\
\mathbf{if}\;t \leq -1.3457258737983367 \cdot 10^{-109}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t \leq 8.385577096170122 \cdot 10^{-56}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 2.45 \cdot 10^{+189}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t \leq 1.25 \cdot 10^{+231}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\]
Alternative 5 Error 8.8 Cost 968
\[\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -3655369533477786.5:\\
\;\;\;\;a \cdot b + z \cdot t\\
\mathbf{elif}\;a \cdot b \leq 1.760804751392109 \cdot 10^{-42}:\\
\;\;\;\;z \cdot t + x \cdot y\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + x \cdot y\\
\end{array}
\]
Alternative 6 Error 29.8 Cost 712
\[\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -1.0343818289721886 \cdot 10^{+40}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;a \cdot b \leq 2.3505536286885863 \cdot 10^{-35}:\\
\;\;\;\;z \cdot t\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
\]
Alternative 7 Error 0.0 Cost 704
\[a \cdot b + \left(z \cdot t + x \cdot y\right)
\]
Alternative 8 Error 41.9 Cost 192
\[z \cdot t
\]