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(y, \log z - t, a \cdot \left(\mathsf{log1p}\left(-z\right) - b\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 y (- (log z) t) (* a (- (log1p (- z)) b)))))) 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(y, (log(z) - t), (a * (log1p(-z) - b))));
}
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(y, Float64(log(z) - t), Float64(a * Float64(log1p(Float64(-z)) - b)))))
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[(y * N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] + N[(a * N[(N[Log[1 + (-z)], $MachinePrecision] - b), $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(y, \log z - t, a \cdot \left(\mathsf{log1p}\left(-z\right) - b\right)\right)}
Alternatives Alternative 1 Error 0.6 Cost 33860
\[\begin{array}{l}
t_1 := y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)\\
\mathbf{if}\;t_1 \leq -5 \cdot 10^{-16}:\\
\;\;\;\;x \cdot e^{t_1}\\
\mathbf{else}:\\
\;\;\;\;x \cdot e^{a \cdot \left(\left(-z\right) - b\right)}\\
\end{array}
\]
Alternative 2 Error 25.9 Cost 7184
\[\begin{array}{l}
t_1 := x \cdot {z}^{y}\\
t_2 := x + a \cdot \left(x \cdot b\right)\\
t_3 := \frac{x \cdot x}{t_2}\\
\mathbf{if}\;b \leq -3 \cdot 10^{+185}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;b \leq -1.25 \cdot 10^{-113}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;b \leq -1.2 \cdot 10^{-167}:\\
\;\;\;\;\frac{\left(a \cdot a\right) \cdot \left(\left(b \cdot b\right) \cdot \left(-x \cdot x\right)\right)}{t_2}\\
\mathbf{elif}\;b \leq 1.95 \cdot 10^{+146}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_3\\
\end{array}
\]
Alternative 3 Error 6.4 Cost 7176
\[\begin{array}{l}
\mathbf{if}\;y \leq -3.6 \cdot 10^{-56}:\\
\;\;\;\;x \cdot e^{y \cdot \left(-t\right)}\\
\mathbf{elif}\;y \leq 1.7 \cdot 10^{-6}:\\
\;\;\;\;x \cdot e^{a \cdot \left(\left(-z\right) - b\right)}\\
\mathbf{else}:\\
\;\;\;\;x \cdot {z}^{y}\\
\end{array}
\]
Alternative 4 Error 24.2 Cost 7052
\[\begin{array}{l}
t_1 := \frac{x \cdot x}{x + a \cdot \left(x \cdot b\right)}\\
\mathbf{if}\;y \leq 9.4 \cdot 10^{-282}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 2.8 \cdot 10^{-103}:\\
\;\;\;\;x \cdot e^{a \cdot b}\\
\mathbf{elif}\;y \leq 5.2 \cdot 10^{-67}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot {z}^{y}\\
\end{array}
\]
Alternative 5 Error 7.8 Cost 7048
\[\begin{array}{l}
\mathbf{if}\;y \leq -5.8 \cdot 10^{-58}:\\
\;\;\;\;x \cdot e^{y \cdot \left(-t\right)}\\
\mathbf{elif}\;y \leq 1.35 \cdot 10^{-6}:\\
\;\;\;\;x \cdot e^{a \cdot \left(-b\right)}\\
\mathbf{else}:\\
\;\;\;\;x \cdot {z}^{y}\\
\end{array}
\]
Alternative 6 Error 10.0 Cost 6916
\[\begin{array}{l}
\mathbf{if}\;y \leq 1.15 \cdot 10^{-6}:\\
\;\;\;\;x \cdot e^{a \cdot \left(-b\right)}\\
\mathbf{else}:\\
\;\;\;\;x \cdot {z}^{y}\\
\end{array}
\]
Alternative 7 Error 33.5 Cost 1676
\[\begin{array}{l}
t_1 := x + a \cdot \left(x \cdot b\right)\\
t_2 := \frac{x \cdot x}{t_1}\\
\mathbf{if}\;x \leq -1.35 \cdot 10^{+154}:\\
\;\;\;\;x + x \cdot \left(\left(a \cdot b\right) \cdot \left(-1 + \left(a \cdot b\right) \cdot 0.5\right)\right)\\
\mathbf{elif}\;x \leq -6.5 \cdot 10^{+18}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq -1.65 \cdot 10^{-43}:\\
\;\;\;\;\frac{\left(a \cdot a\right) \cdot \left(\left(b \cdot b\right) \cdot \left(-x \cdot x\right)\right)}{t_1}\\
\mathbf{elif}\;x \leq 1.32 \cdot 10^{+154}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\]
Alternative 8 Error 32.6 Cost 1092
\[\begin{array}{l}
\mathbf{if}\;x \leq -1.35 \cdot 10^{+154}:\\
\;\;\;\;x + x \cdot \left(\left(a \cdot b\right) \cdot \left(-1 + \left(a \cdot b\right) \cdot 0.5\right)\right)\\
\mathbf{elif}\;x \leq 1.32 \cdot 10^{+154}:\\
\;\;\;\;\frac{x \cdot x}{x + a \cdot \left(x \cdot b\right)}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\]
Alternative 9 Error 32.6 Cost 968
\[\begin{array}{l}
\mathbf{if}\;x \leq -1.35 \cdot 10^{+154}:\\
\;\;\;\;x - x \cdot \left(a \cdot b\right)\\
\mathbf{elif}\;x \leq 1.32 \cdot 10^{+154}:\\
\;\;\;\;\frac{x \cdot x}{x + a \cdot \left(x \cdot b\right)}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\]
Alternative 10 Error 39.4 Cost 648
\[\begin{array}{l}
\mathbf{if}\;y \leq -1.32 \cdot 10^{+19}:\\
\;\;\;\;a \cdot \left(x \cdot b\right)\\
\mathbf{elif}\;y \leq 6.8 \cdot 10^{-18}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(x \cdot \left(-b\right)\right)\\
\end{array}
\]
Alternative 11 Error 39.4 Cost 648
\[\begin{array}{l}
\mathbf{if}\;y \leq -2.6 \cdot 10^{+18}:\\
\;\;\;\;a \cdot \left(x \cdot b\right)\\
\mathbf{elif}\;y \leq 6.8 \cdot 10^{-18}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;b \cdot \left(x \cdot \left(-a\right)\right)\\
\end{array}
\]
Alternative 12 Error 39.5 Cost 585
\[\begin{array}{l}
\mathbf{if}\;y \leq -1.52 \cdot 10^{+21} \lor \neg \left(y \leq 6.8 \cdot 10^{-18}\right):\\
\;\;\;\;a \cdot \left(x \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\]
Alternative 13 Error 44.2 Cost 64
\[x
\]