next up previous index
Next: C303 Gamma Function Up: CERNLIB Previous: C301 Normal Frequency

C302 Gamma Function for Positive Argument

Routine ID: C302
Author(s): K.S. KölbigLibrary: MATHLIB or Fortran Computer Library
Submitter: Submitted: 07.06.1992
Language: FortranRevised: 15.03.1993

Function subprograms GAMMA, DGAMMA and QGAMMA calculate the gamma function

Γ(x) = ∫0&inf;e-ttx-1dt(x > 0)

for real argument x > 0.

The quadruple-precision version QGAMMA is available only on computers which support a REAL*16 Fortran data type.

Structure:

FUNCTION subprograms
User Entry Names: GAMMA, DGAMMA, QGAMMA
Files Referenced: Unit 6
External References: MTLMTR (N002), ABEND (Z035)

Usage:

In any arithmetic expression, GAMMA(X), DGAMMA(X) or QGAMMA(X) has the value Γ(X) ,

where GAMMA is of type REAL, DGAMMA is of type DOUBLE PRECISION, QGAMMA is of type REAL*16, and X has the same type as the function name.

Method:

Approximation by truncated Chebyshev series and functional relations.

Accuracy:

The system-supplied version (see Notes) has full machine accuracy. The CERN version of GAMMA (except on CDC and Cray computers) has full single-precision accuracy. The CERN version of DGAMMA, QGAMMA (and of GAMMA, DGAMMA on CDC and Cray computers) have an accuracy which is approximately one digit less than machine precision.

Error handling:

Error C302.1: X ≤0 . The function value is set equal to zero, and a message is written on Unit 6 unless subroutine MTLSET (N002) has been called.

Notes:

If the function GAMMA or DGAMMA is available in the system-supplied Fortran mathematical library, the system-supplied function will be loaded instead of the CERN version.

References:

  1. Y.L. Luke, Mathematical functions and their approximations, (Academic Press, New York 1975) 4.

C303



next up previous index
Next: C303 Gamma Function Up: CERNLIB Previous: C301 Normal Frequency


Janne Saarela
Mon Apr 3 15:06:23 METDST 1995