Calculate the log of the Gamma function
Calculate the CEPHES function, lgam, in the range [0 <= z <= MAXLGM]. The function returns the base e (2.718...) logarithm of the absolute value of the Gamma function of the argument (scalar or array).
For arguments greater than 13, the logarithm of the Gamma function is approximated by the logarithmic version of Stirling's formula using a polynomial approximation of degree 4. Arguments between -33 and +33 are reduced by recurrence to the interval [2,3] of a rational approximation. The cosecant reflection formula is employed for arguments less than -33.
Arguments greater than MAXLGM return MAXNUM and an error message. MAXLGM = 2.035093e36 for DEC arithmetic or 2.556348e305 for IEEE arithmetic.
The error criterion was relative when the function magnitude was greater than one but absolute when it was less than one.
The following test used the relative error criterion, though at certain points the relative error could be much higher than indicated.
Cephes Math Library Release 2.0: April, 1987. Copyright 1985, 1987 by Stephen L. Moshier. Direct inquiries to 30 Frost Street, Cambridge, MA 02140.
Calculate the lgam of 3.14.
Calculate the lgam of the array [3.14,2.71].
See the bugs pages on the Sherpa website for an up-to-date listing of known bugs.