DGAMLN(3)

SYNOPSIS
DOUBLE PRECISION FUNCTION DGAMLN (Z, IERR)

NAME
dgamln - Compute the logarithm of the Gamma function

LIBRARY
SLATEC

CATEGORY
C7A

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

KEYWORDS
LOGARITHM OF GAMMA FUNCTION

AUTHOR
Amos, D. E., (SNL)

DESCRIPTION
**** A DOUBLE PRECISION ROUTINE **** DGAMLN 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 IS D0UBLE PRECISION Z - ARGUMENT, Z.GT.0.0D0 OUTPUT DGAMLN IS DOUBLE PRECISION DGAMLN - NATURAL LOG OF THE GAMMA FUNCTION AT Z.NE.0.0D0 IERR - ERROR FLAG IERR=0, NORMAL RETURN, COMPUTATION COMPLETED IERR=1, Z.LE.0.0D0, NO COMPUTATION

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

ROUTINES CALLED
D1MACH, I1MACH

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 DGAMLN defined for Z negative. (WRB)