asa245, a FORTRAN90 code which evaluates the logarithm of the gamma function, by Allan Mcleod;

The code is Applied Statistics Algorithm 245.


The computer code and data files described and made available on this web page are distributed under the MIT license


asa245 is available in a C version and a C++ version and a Fortran90 version and a MATLAB version and a Python version.

Related Data and Programs:


FN, a FORTRAN90 code which approximates elementary and special functions using Chebyshev polynomials, by Wayne Fullerton.

SLATEC, a FORTRAN90 code which evaluates many special functions.

SPECFUN, a FORTRAN90 code which evaluates certain special functions using fitted data.

TEST_VALUES, a FORTRAN90 code which contains sample values for a number of distributions.

TOMS291, a FORTRAN90 code which evaluates the logarithm of the Gamma function.


Original FORTRAN77 version by Allan Mcleod; FORTRAN90 version by John Burkardt.


  1. Cornelius Lanczos,
    A precision approximation of the gamma function,
    SIAM Journal on Numerical Analysis, B,
    Volume 1, 1964, pages 86-96.
  2. Allan Mcleod,
    Algorithm AS 245: A Robust and Reliable Algorithm for the Logarithm of the Gamma Function,
    Applied Statistics,
    Volume 38, Number 2, 1989, pages 397-402.

Source Code:

Last revised on 22 May 2020.