Math FPCore C Julia Wolfram TeX \[x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)}
\]
↓
\[x \cdot e^{\mathsf{fma}\left(a, \mathsf{log1p}\left(-z\right) - b, y \cdot \left(\log z - t\right)\right)}
\]
(FPCore (x y z t a b)
:precision binary64
(* x (exp (+ (* y (- (log z) t)) (* a (- (log (- 1.0 z)) b)))))) ↓
(FPCore (x y z t a b)
:precision binary64
(* x (exp (fma a (- (log1p (- z)) b) (* y (- (log z) t)))))) double code(double x, double y, double z, double t, double a, double b) {
return x * exp(((y * (log(z) - t)) + (a * (log((1.0 - z)) - b))));
}
↓
double code(double x, double y, double z, double t, double a, double b) {
return x * exp(fma(a, (log1p(-z) - b), (y * (log(z) - t))));
}
function code(x, y, z, t, a, b)
return Float64(x * exp(Float64(Float64(y * Float64(log(z) - t)) + Float64(a * Float64(log(Float64(1.0 - z)) - b)))))
end
↓
function code(x, y, z, t, a, b)
return Float64(x * exp(fma(a, Float64(log1p(Float64(-z)) - b), Float64(y * Float64(log(z) - t)))))
end
code[x_, y_, z_, t_, a_, b_] := N[(x * N[Exp[N[(N[(y * N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision] + N[(a * N[(N[Log[N[(1.0 - z), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
↓
code[x_, y_, z_, t_, a_, b_] := N[(x * N[Exp[N[(a * N[(N[Log[1 + (-z)], $MachinePrecision] - b), $MachinePrecision] + N[(y * N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)}
↓
x \cdot e^{\mathsf{fma}\left(a, \mathsf{log1p}\left(-z\right) - b, y \cdot \left(\log z - t\right)\right)}
Alternatives Alternative 1 Accuracy 99.5% Cost 26368
\[x \cdot e^{\mathsf{fma}\left(a, \mathsf{log1p}\left(-z\right) - b, y \cdot \left(\log z - t\right)\right)}
\]
Alternative 2 Accuracy 96.4% Cost 20160
\[x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)}
\]
Alternative 3 Accuracy 85.7% Cost 13776
\[\begin{array}{l}
t_1 := x \cdot e^{y \cdot \left(\log z - t\right)}\\
\mathbf{if}\;y \leq -7.4 \cdot 10^{-37}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 1.6 \cdot 10^{-134}:\\
\;\;\;\;x \cdot e^{a \cdot \left(\left(-z\right) - b\right)}\\
\mathbf{elif}\;y \leq 2.4 \cdot 10^{-86}:\\
\;\;\;\;x \cdot e^{t \cdot \left(-y\right)}\\
\mathbf{elif}\;y \leq 0.9:\\
\;\;\;\;x \cdot e^{a \cdot \left(-b\right)}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
Alternative 4 Accuracy 72.3% Cost 7576
\[\begin{array}{l}
t_1 := x \cdot e^{a \cdot \left(-b\right)}\\
t_2 := x \cdot e^{t \cdot \left(-y\right)}\\
t_3 := x \cdot {z}^{y}\\
\mathbf{if}\;t \leq -3.4 \cdot 10^{+50}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t \leq -4.5 \cdot 10^{-134}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 8 \cdot 10^{-207}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;t \leq 7 \cdot 10^{-107}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 5 \cdot 10^{-49}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;t \leq 1.8 \cdot 10^{+87}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\]
Alternative 5 Accuracy 72.0% Cost 7308
\[\begin{array}{l}
t_1 := x \cdot e^{a \cdot \left(\left(-z\right) - b\right)}\\
\mathbf{if}\;a \leq -3.7 \cdot 10^{+59}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;a \leq -2.75 \cdot 10^{-223}:\\
\;\;\;\;x \cdot {z}^{y}\\
\mathbf{elif}\;a \leq 3.1 \cdot 10^{+36}:\\
\;\;\;\;x \cdot e^{t \cdot \left(-y\right)}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
Alternative 6 Accuracy 53.9% Cost 7049
\[\begin{array}{l}
\mathbf{if}\;a \leq -2 \cdot 10^{+60} \lor \neg \left(a \leq 3.1 \cdot 10^{+171}\right):\\
\;\;\;\;x \cdot e^{a \cdot \left(-z\right)}\\
\mathbf{else}:\\
\;\;\;\;x \cdot {z}^{y}\\
\end{array}
\]
Alternative 7 Accuracy 73.8% Cost 7049
\[\begin{array}{l}
\mathbf{if}\;y \leq -4.6 \cdot 10^{-8} \lor \neg \left(y \leq 4.4\right):\\
\;\;\;\;x \cdot {z}^{y}\\
\mathbf{else}:\\
\;\;\;\;x \cdot e^{a \cdot \left(-b\right)}\\
\end{array}
\]
Alternative 8 Accuracy 54.6% Cost 6984
\[\begin{array}{l}
\mathbf{if}\;t \leq -8.2 \cdot 10^{+199}:\\
\;\;\;\;y \cdot \left(-x \cdot t\right)\\
\mathbf{elif}\;t \leq -1 \cdot 10^{+50}:\\
\;\;\;\;x \cdot e^{a \cdot b}\\
\mathbf{else}:\\
\;\;\;\;x \cdot {z}^{y}\\
\end{array}
\]
Alternative 9 Accuracy 53.5% Cost 6920
\[\begin{array}{l}
\mathbf{if}\;t \leq -7.6 \cdot 10^{+233}:\\
\;\;\;\;y \cdot \left(-x \cdot t\right)\\
\mathbf{elif}\;t \leq -9.5 \cdot 10^{+38}:\\
\;\;\;\;a \cdot \left(x \cdot \left(-z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot {z}^{y}\\
\end{array}
\]
Alternative 10 Accuracy 28.4% Cost 1484
\[\begin{array}{l}
t_1 := a \cdot \left(x \cdot \left(-z\right)\right)\\
t_2 := x - y \cdot \left(x \cdot t\right)\\
\mathbf{if}\;x \leq -8.5 \cdot 10^{-122}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq 8.5 \cdot 10^{-218}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 5.9 \cdot 10^{-133}:\\
\;\;\;\;x \cdot \frac{1 - \left(y \cdot t\right) \cdot \left(y \cdot t\right)}{y \cdot t + 1}\\
\mathbf{elif}\;x \leq 1.6 \cdot 10^{-19}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 8.5 \cdot 10^{+63} \lor \neg \left(x \leq 1.1 \cdot 10^{+165}\right):\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;\left(-x\right) \cdot \left(a \cdot b\right)\\
\end{array}
\]
Alternative 11 Accuracy 27.7% Cost 1241
\[\begin{array}{l}
t_1 := a \cdot \left(x \cdot \left(-z\right)\right)\\
t_2 := x - y \cdot \left(x \cdot t\right)\\
\mathbf{if}\;x \leq -6 \cdot 10^{-122}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq 1.26 \cdot 10^{-230}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 8.5 \cdot 10^{-148}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 2.7 \cdot 10^{-16}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 6 \cdot 10^{+63} \lor \neg \left(x \leq 3.05 \cdot 10^{+165}\right):\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;\left(-x\right) \cdot \left(a \cdot b\right)\\
\end{array}
\]
Alternative 12 Accuracy 22.2% Cost 912
\[\begin{array}{l}
t_1 := a \cdot \left(x \cdot \left(-z\right)\right)\\
\mathbf{if}\;x \leq -9.5 \cdot 10^{-122}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1.26 \cdot 10^{-230}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 10^{-147}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 6.6 \cdot 10^{-18}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(t \cdot \left(-y\right)\right)\\
\end{array}
\]
Alternative 13 Accuracy 22.4% Cost 912
\[\begin{array}{l}
t_1 := a \cdot \left(x \cdot \left(-z\right)\right)\\
\mathbf{if}\;x \leq -4.4 \cdot 10^{-123}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1.06 \cdot 10^{-230}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 8 \cdot 10^{-148}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 4.5 \cdot 10^{-12}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(-x \cdot t\right)\\
\end{array}
\]
Alternative 14 Accuracy 29.6% Cost 844
\[\begin{array}{l}
\mathbf{if}\;t \leq -3.5 \cdot 10^{+236}:\\
\;\;\;\;y \cdot \left(-x \cdot t\right)\\
\mathbf{elif}\;t \leq -1.96 \cdot 10^{+37}:\\
\;\;\;\;a \cdot \left(x \cdot \left(-z\right)\right)\\
\mathbf{elif}\;t \leq 1.65 \cdot 10^{-19}:\\
\;\;\;\;x - a \cdot \left(x \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - y \cdot t\right)\\
\end{array}
\]
Alternative 15 Accuracy 29.6% Cost 844
\[\begin{array}{l}
\mathbf{if}\;t \leq -9.2 \cdot 10^{+234}:\\
\;\;\;\;y \cdot \left(-x \cdot t\right)\\
\mathbf{elif}\;t \leq -8.4 \cdot 10^{+38}:\\
\;\;\;\;a \cdot \left(x \cdot \left(-z\right)\right)\\
\mathbf{elif}\;t \leq 4.3 \cdot 10^{-16}:\\
\;\;\;\;x - a \cdot \left(x \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x - x \cdot \left(y \cdot t\right)\\
\end{array}
\]
Alternative 16 Accuracy 30.1% Cost 712
\[\begin{array}{l}
\mathbf{if}\;b \leq -5.6 \cdot 10^{+198}:\\
\;\;\;\;b \cdot \left(-x \cdot a\right)\\
\mathbf{elif}\;b \leq 1.9 \cdot 10^{+95}:\\
\;\;\;\;x \cdot \left(1 - y \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(x \cdot \left(-z\right)\right)\\
\end{array}
\]
Alternative 17 Accuracy 23.0% Cost 516
\[\begin{array}{l}
\mathbf{if}\;y \leq 6.5 \cdot 10^{-178}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(x \cdot \left(-z\right)\right)\\
\end{array}
\]
Alternative 18 Accuracy 21.0% Cost 452
\[\begin{array}{l}
\mathbf{if}\;a \leq 2.7 \cdot 10^{+38}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(y \cdot t\right)\\
\end{array}
\]
Alternative 19 Accuracy 21.1% Cost 452
\[\begin{array}{l}
\mathbf{if}\;a \leq 2.1 \cdot 10^{+40}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(x \cdot t\right)\\
\end{array}
\]
Alternative 20 Accuracy 19.6% Cost 64
\[x
\]