Microsoft Knowledge Base
Excel: ATP Definition: GAMMALN
Last reviewed: January 30, 1996
Article ID: Q87863
The information in this article applies to:
- Microsoft Excel for Windows 95, version 7.0
- Microsoft Excel for Windows, versions 4.0, 5.0
- Microsoft Excel for the Macintosh, versions 4.0, 5.0
SUMMARY
The versions of Microsoft listed above provide a set of special analysis tools called the Analysis ToolPak. This article is part of a series of articles that provide information on the underlying formulas used in the Analysis ToolPak.
This article covers the following function:
GAMMALN(x)
MORE INFORMATION
The GAMMALN function returns the natural logarithm of the gamma function for a particular value of the random variable X. The Excel function is implemented with the following C routine:
#include <math.h>
float gammln(xx) float xx;
{
double x,tmp,ser; static double cof[6]={76.18009173,-86.50532033,24.01409822,- 1.231739516,0.120858003e-2,-0.536382e-5};
int j;
x=xx-1.0; tmp=x+5.5; ser=1.0; for (j=0;j<=5;j++){
x += 1.0; ser += cof[j]/x; }
return -tmp+log(2.50662827465*); }
For large values of X, the GAMMALN() function is often better to use than the GAMMADIST() function because it is less likely to overflow a computer's floating point representation.
REFERENCES
"Numerical Recipies in C," Press, Flannery et al, page 168
"Microsoft Excel Function Reference," version 4.0, page 188
KBCategory: kbusage kbref Last reviewed: January 30, 1996 |