HP 3000 Manuals

gamma [ HP C/iX Library Reference Manual ] MPE/iX 5.0 Documentation


HP C/iX Library Reference Manual

gamma 

Returns the log gamma of the input value.

Syntax 

     #include <math.h>
     double gamma (double x);
     extern int signgam;

Parameters 

x             A real number.

Return Values 

n             A real number giving the natural log of the absolute value
              of the gamma of x.

HUGE          Indicates one of the following:

                 *   The parameter x is a non-positive integer, and errno
                     is set to EDOM. A message indicating SING error is
                     printed on the standard error output.

                 *   An overflow condition has occurred, and errno is set
                     to ERANGE.

Description 

gamma returns:

     ln( | gamma(x) | )

where:

     gamma(x)

is defined as:

[]
The sign of gamma(x) is returned in the external integer signgam. The argument x must be greater than or equal to zero. (The gamma function is defined over the reals excluding the non-positive integers.) The following C program fragment can be used to calculate gamma: if ((y = gamma(x)) > LN_MAXDOUBLE) error(); y = signgam * exp(y); where LN_MAXDOUBLE is the lowest value that causes exp to return a range error, and is defined in the <values.h> header file. Error handling can be changed by a user-written matherr function.


MPE/iX 5.0 Documentation