Math FPCore C Julia Wolfram TeX \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c
\]
↓
\[\mathsf{fma}\left(t, \frac{z}{16}, \mathsf{fma}\left(x, y, c - b \cdot \frac{a}{4}\right)\right)
\]
(FPCore (x y z t a b c)
:precision binary64
(+ (- (+ (* x y) (/ (* z t) 16.0)) (/ (* a b) 4.0)) c)) ↓
(FPCore (x y z t a b c)
:precision binary64
(fma t (/ z 16.0) (fma x y (- c (* b (/ a 4.0)))))) double code(double x, double y, double z, double t, double a, double b, double c) {
return (((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0)) + c;
}
↓
double code(double x, double y, double z, double t, double a, double b, double c) {
return fma(t, (z / 16.0), fma(x, y, (c - (b * (a / 4.0)))));
}
function code(x, y, z, t, a, b, c)
return Float64(Float64(Float64(Float64(x * y) + Float64(Float64(z * t) / 16.0)) - Float64(Float64(a * b) / 4.0)) + c)
end
↓
function code(x, y, z, t, a, b, c)
return fma(t, Float64(z / 16.0), fma(x, y, Float64(c - Float64(b * Float64(a / 4.0)))))
end
code[x_, y_, z_, t_, a_, b_, c_] := N[(N[(N[(N[(x * y), $MachinePrecision] + N[(N[(z * t), $MachinePrecision] / 16.0), $MachinePrecision]), $MachinePrecision] - N[(N[(a * b), $MachinePrecision] / 4.0), $MachinePrecision]), $MachinePrecision] + c), $MachinePrecision]
↓
code[x_, y_, z_, t_, a_, b_, c_] := N[(t * N[(z / 16.0), $MachinePrecision] + N[(x * y + N[(c - N[(b * N[(a / 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c
↓
\mathsf{fma}\left(t, \frac{z}{16}, \mathsf{fma}\left(x, y, c - b \cdot \frac{a}{4}\right)\right)
Alternatives Alternative 1 Accuracy 67.9% Cost 1748
\[\begin{array}{l}
t_1 := c + t \cdot \left(z \cdot 0.0625\right)\\
t_2 := c + a \cdot \left(b \cdot -0.25\right)\\
t_3 := c + x \cdot y\\
\mathbf{if}\;b \cdot a \leq -5 \cdot 10^{+53}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;b \cdot a \leq -1.2 \cdot 10^{-60}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;b \cdot a \leq 10^{-43}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;b \cdot a \leq 2000000000000:\\
\;\;\;\;t_1\\
\mathbf{elif}\;b \cdot a \leq 5 \cdot 10^{+62}:\\
\;\;\;\;t_3\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\]
Alternative 2 Accuracy 66.1% Cost 1368
\[\begin{array}{l}
t_1 := x \cdot y - \left(b \cdot a\right) \cdot 0.25\\
t_2 := c + t \cdot \left(z \cdot 0.0625\right)\\
\mathbf{if}\;c \leq -3.9 \cdot 10^{-57}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;c \leq -2.2 \cdot 10^{-234}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \leq 1.6 \cdot 10^{-282}:\\
\;\;\;\;x \cdot y + 0.0625 \cdot \left(t \cdot z\right)\\
\mathbf{elif}\;c \leq 7.2 \cdot 10^{-47}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \leq 2.05 \cdot 10^{+18}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;c \leq 1.4 \cdot 10^{+82}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;c + x \cdot y\\
\end{array}
\]
Alternative 3 Accuracy 90.8% Cost 1352
\[\begin{array}{l}
t_1 := \left(b \cdot a\right) \cdot 0.25\\
t_2 := 0.0625 \cdot \left(t \cdot z\right)\\
\mathbf{if}\;b \cdot a \leq -1 \cdot 10^{+54}:\\
\;\;\;\;\left(c + x \cdot y\right) - t_1\\
\mathbf{elif}\;b \cdot a \leq 2 \cdot 10^{+84}:\\
\;\;\;\;c + \left(x \cdot y + t_2\right)\\
\mathbf{else}:\\
\;\;\;\;\left(c + t_2\right) - t_1\\
\end{array}
\]
Alternative 4 Accuracy 86.7% Cost 1225
\[\begin{array}{l}
\mathbf{if}\;b \cdot a \leq -1 \cdot 10^{+54} \lor \neg \left(b \cdot a \leq 2 \cdot 10^{+136}\right):\\
\;\;\;\;c + a \cdot \left(b \cdot -0.25\right)\\
\mathbf{else}:\\
\;\;\;\;c + \left(x \cdot y + 0.0625 \cdot \left(t \cdot z\right)\right)\\
\end{array}
\]
Alternative 5 Accuracy 91.4% Cost 1225
\[\begin{array}{l}
\mathbf{if}\;b \cdot a \leq -1 \cdot 10^{+54} \lor \neg \left(b \cdot a \leq 2000000000000\right):\\
\;\;\;\;\left(c + x \cdot y\right) - \left(b \cdot a\right) \cdot 0.25\\
\mathbf{else}:\\
\;\;\;\;c + \left(x \cdot y + 0.0625 \cdot \left(t \cdot z\right)\right)\\
\end{array}
\]
Alternative 6 Accuracy 44.2% Cost 1116
\[\begin{array}{l}
t_1 := t \cdot \left(z \cdot 0.0625\right)\\
\mathbf{if}\;c \leq -0.00335:\\
\;\;\;\;c\\
\mathbf{elif}\;c \leq -2.6 \cdot 10^{-73}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \leq -1.55 \cdot 10^{-214}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;c \leq -1.18 \cdot 10^{-275}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \leq 3.9 \cdot 10^{-199}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;c \leq 2.5 \cdot 10^{-61}:\\
\;\;\;\;\left(b \cdot a\right) \cdot -0.25\\
\mathbf{elif}\;c \leq 1.55 \cdot 10^{+92}:\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;c\\
\end{array}
\]
Alternative 7 Accuracy 99.9% Cost 1088
\[c + \left(\left(\frac{t \cdot z}{16} + x \cdot y\right) - \frac{b \cdot a}{4}\right)
\]
Alternative 8 Accuracy 67.8% Cost 969
\[\begin{array}{l}
\mathbf{if}\;b \cdot a \leq -1 \cdot 10^{+54} \lor \neg \left(b \cdot a \leq 5 \cdot 10^{+62}\right):\\
\;\;\;\;c + a \cdot \left(b \cdot -0.25\right)\\
\mathbf{else}:\\
\;\;\;\;c + x \cdot y\\
\end{array}
\]
Alternative 9 Accuracy 44.1% Cost 852
\[\begin{array}{l}
t_1 := t \cdot \left(z \cdot 0.0625\right)\\
\mathbf{if}\;c \leq -1.35:\\
\;\;\;\;c\\
\mathbf{elif}\;c \leq -2.3 \cdot 10^{-73}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \leq -4.2 \cdot 10^{-214}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;c \leq -2.65 \cdot 10^{-275}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \leq 3.7 \cdot 10^{+88}:\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;c\\
\end{array}
\]
Alternative 10 Accuracy 63.0% Cost 841
\[\begin{array}{l}
\mathbf{if}\;b \cdot a \leq -4.8 \cdot 10^{+98} \lor \neg \left(b \cdot a \leq 2.35 \cdot 10^{+111}\right):\\
\;\;\;\;\left(b \cdot a\right) \cdot -0.25\\
\mathbf{else}:\\
\;\;\;\;c + x \cdot y\\
\end{array}
\]
Alternative 11 Accuracy 43.8% Cost 456
\[\begin{array}{l}
\mathbf{if}\;c \leq -1.85 \cdot 10^{-54}:\\
\;\;\;\;c\\
\mathbf{elif}\;c \leq 2.3 \cdot 10^{+87}:\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;c\\
\end{array}
\]
Alternative 12 Accuracy 31.9% Cost 64
\[c
\]