next up previous index
Next: C304 Logarithm of Up: CERNLIB Previous: C302 Gamma Function

C303 Gamma Function for Real Argument

Routine ID: C303
Author(s): K.S. KölbigLibrary: MATHLIB
Submitter: Submitted: 07.06 1992
Language: FortranRevised:

Function subprograms GAMMF and DGAMMF calculate the gamma function

Γ(x) = ∫0&inf;e-ttx-1dt(x > 0), Γ(x) = {πΓ(1-x) sinπx}(x<0)

for real argument x ≠-n,(n = 0,1,2,...) .

On CDC and Cray computers, the double-precision version DGAMMF is not available.

Structure:

FUNCTION subprograms
User Entry Names: GAMMF, DGAMMF
Files Referenced: Unit 6
External References: MTLMTR (N002), ABEND (Z035)

Usage:

In any arithmetic expression, GAMMF(X) or DGAMMF(X) has the value Γ(X) ,

where GAMMF is of type REAL, DGAMMF is of type DOUBLE PRECISION, and X has the same type as the function name.

Method:

Approximation by truncated Chebyshev series and functional relations.

Accuracy:

GAMMF (except on CDC and Cray computers) has full single-precision accuracy. DGAMMF (and of GAMMF on CDC and Cray computers) has an accuracy which is approximately one digit less than machine precision.

Error handling:

Error C303.1: X= -n,(n = 0,1,2,...).

The function value is set equal to zero, and a message is written on Unit 6, unless subroutine MTLSET (N002) has been called.

References:

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

C304


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