ln_gamma

Function ln_gamma 

Source
pub fn ln_gamma(x: f64) -> f64
Expand description

Natural log of the gamma function on the positive reals.

Lanczos approximation (g = 7, 9 coefficients). The honest error claim is relative, not absolute – ln_gamma’s output ranges over many orders of magnitude, so a fixed absolute bound is not meaningful at the extremes: measured relative error is <= 2.2e-15 (about 1 ULP) across the tested range, comfortably inside both the 1e-12 absolute bound the tests pin there and the ~1e-10 the beta-binomial mixture confidence sequence actually needs. Returns NaN for x <= 0 and non-finite inputs – this crate’s special functions are total functions with NaN as the out-of-domain signal rather than panicking, though unlike erf (which returns a defined limit, +-1.0, at +-infinity), ln_gamma has no finite limit there and returns NaN for every non-finite input, not just NaN itself.