HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Modulemath-functions-0.3.4.4Haskell2010

Numeric.SpecFunctions.Extra

Less common mathematical functions.

  • 5 values
valuelogChooseFast :: Double -> Double -> Double
#

Quickly compute the natural logarithm of n choose k, with no checking.

Less numerically stable:

exp $ lg (n+1) - lg (k+1) - lg (n-k+1)
  where lg = logGamma . fromIntegral
valuelogGammaAS245 :: Double -> Double
#

Compute the logarithm of the gamma function Γ(x). Uses Algorithm AS 245 by Macleod.

Gives an accuracy of 10-12 significant decimal digits, except for small regions around x = 1 and x = 2, where the function goes to zero. For greater accuracy, use logGammaL.

Returns ∞ if the input is outside of the range (0 < x ≤ 1e305).

Compute the log gamma correction factor for Stirling approximation for x ≥ 10. This correction factor is suitable for an alternate (but less numerically accurate) definition of logGamma:

\log\Gamma(x) = \frac{1}{2}\log(2\pi) + (x-\frac{1}{2})\log x - x + \operatorname{logGammaCorrection}(x)