GAMLN(3)

SYNOPSIS
REAL FUNCTION GAMLN (Z, IERR)

NAME
gamln - Compute the logarithm of the Gamma function

LIBRARY
SLATEC

CATEGORY
C7A

TYPE
SINGLE PRECISION (GAMLN-S, DGAMLN-D)

KEYWORDS
LOGARITHM OF GAMMA FUNCTION

AUTHOR
Amos, D. E., (SNL)

DESCRIPTION
GAMLN COMPUTES THE NATURAL LOG OF THE GAMMA FUNCTION FOR Z.GT.0. THE ASYMPTOTIC EXPANSION IS USED TO GENERATE VALUES GREATER THAN ZMIN WHICH ARE ADJUSTED BY THE RECURSION G(Z+1)=Z*G(Z) FOR Z.LE.ZMIN. THE FUNCTION WAS MADE AS PORTABLE AS POSSIBLE BY COMPUTING ZMIN FROM THE NUMBER OF BASE 10 DIGITS IN A WORD, RLN=MAX(-ALOG10(R1MACH(4)),0.5E-18) LIMITED TO 18 DIGITS OF (RELATIVE) ACCURACY. SINCE INTEGER ARGUMENTS ARE COMMON, A TABLE LOOK UP ON 100 VALUES IS USED FOR SPEED OF EXECUTION. DESCRIPTION OF ARGUMENTS INPUT Z - REAL ARGUMENT, Z.GT.0.0E0 OUTPUT GAMLN - NATURAL LOG OF THE GAMMA FUNCTION AT Z IERR - ERROR FLAG IERR=0, NORMAL RETURN, COMPUTATION COMPLETED IERR=1, Z.LE.0.0E0, NO COMPUTATION

REFERENCES
COMPUTATION OF BESSEL FUNCTIONS OF COMPLEX ARGUMENT BY D. E. AMOS, SAND83-0083, MAY, 1983.

ROUTINES CALLED
I1MACH, R1MACH

REVISION HISTORY (YYMMDD)
830501 DATE WRITTEN
830501 REVISION DATE from Version 3.2
910415 Prologue converted to Version 4.0 format. (BAB)
920128 Category corrected. (WRB)
921215 GAMLN defined for Z negative. (WRB)