Syntax
| Parameter | Description |
|---|---|
| x | Parameter of the GAMMALN function. |
Examples
Log-gamma of 5 (related to 4!)
=GAMMALN(5)
Computing binomial coefficient
=EXP(GAMMALN(21)-GAMMALN(6)-GAMMALN(16))
Half-integer argument
=GAMMALN(0.5)
Common Errors
x must be positive. GAMMALN is undefined for zero and negative values.
Occurs when the argument is non-numeric text.
Tips
Use GAMMALN instead of computing factorials directly. Factorials grow extremely fast — 170! overflows standard floating point, but GAMMALN(171) works fine.
To get the actual gamma function value, use =EXP(GAMMALN(x)). But only do this when the result is small enough not to overflow.
For combinations C(n,k), use =EXP(GAMMALN(n+1) - GAMMALN(k+1) - GAMMALN(n-k+1)). This works for much larger values than direct factorial computation.
Try GAMMALN in Viztab
Import your data and use GAMMALN with 370+ other formulas. No signup required.
Open Viztab