Microsoft KB Archive/87863

From BetaArchive Wiki

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

KBSubcategory:

Additional reference words: 7.00 5.00 4.00 atp tool pak pack


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: January 30, 1996
©1997 Microsoft Corporation. All rights reserved. Legal Notices.