Expand description
$\ln\Gamma(1+v)$ and $\Gamma(1+v)-1$ on $\lvert v\rvert \le 1/2$, both signs at once.
§Why these exist as their own functions
$\Gamma(1+v) - 1$ cannot be computed as tgamma(1 + v) - 1. Near zero
$\Gamma(1+v) \approx 1 - \gamma v$, so subtracting one throws away every bit that is not
in $\gamma v$. About 7 bits lost at $v = 10^{-2}$, 27 at $10^{-8}$, all of them by
$10^{-16}$.
That matters because Temme’s series, the small-x arm for $Y_\nu$, forms
g_1 = \frac{g_+ - g_-}{(1+g_+)(1+g_-)\,2v}, \qquad g_\pm = \Gamma(1\pm v) - 1which is $0/0$ as $v \to 0$ and needs both $g_\pm$ to full relative accuracy to
resolve it. Boost carries a dedicated tgamma1pm1 for exactly this reason.
§The route taken, and what it avoids
$\Gamma(1+v) - 1 = \mathrm{expm1}(\ln\Gamma(1+v))$, with $\ln\Gamma(1+v)$ from its
$\zeta$ series. The series has no subtraction of near-equal quantities anywhere, so it
is uniformly accurate across the range including at $v = 0$, where it simply returns zero.
The alternative was a fitted rational, which would have needed the parked minimax tooling.
Every coefficient here is $\zeta(k)/k$ computed to 60 digits and rounded once: exact
constants, not an approximation. See [crate::tables::lgamma1p].
Both signs come out of one evaluation, because the series splits by parity and Temme wants
$\pm v$ anyway.
Functions§
- lgamma1p_
pair $(\ln\Gamma(1+v),\; \ln\Gamma(1-v))$for$\lvert v\rvert \le 1/2$.- tgamma1pm1_
pair $(\Gamma(1+v) - 1,\; \Gamma(1-v) - 1)$for$\lvert v\rvert \le 1/2$.