FLINT3.7.0-dev

arb_hypgeom_gamma_stirling

Synopsis#include <flint/arb_hypgeom.h>
void arb_hypgeom_gamma_stirling(arb_t res, const arb_t x, int reciprocal, slong prec)source

Sets res to \Gamma(x), or 1/\Gamma(x) if reciprocal is nonzero, computed with the Stirling series after argument reduction.

For x < -5 the reflection formula \Gamma(x) = \pi / (\sin(\pi x) \Gamma(1-x)) is applied first. The argument is then shifted by a rising factorial to x + r \ge \beta \cdot \mathit{prec}, where \beta is between 0.17 and 0.24 depending on the precision, and the number of terms is chosen so that the bound for the remainder of the Stirling series is below 2^{-\mathit{prec}}. The working precision is increased by the number of exponent bits of large x and limited by the accuracy of the input. Arguments with more than about 10\,\mathit{prec} + 4096 exponent bits give an indeterminate result. See The Stirling series.

Cite this page

The FLINT team, “arb_hypgeom_gamma_stirling (arb_hypgeom.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/arb_hypgeom/arb_hypgeom_gamma_stirling.html (generated 2026-10-20).