man(1) Manual page archive


     GAMMA(3M)                                               GAMMA(3M)

     NAME
          gamma - log gamma function

     SYNOPSIS
          #include <math.h>

          double gamma(x)
          double x;

          extern int signgam;

     DESCRIPTION
          Gamma returns ln |Γ(x)|.  The sign of Γ(x) is returned in
          the external integer signgam.

     EXAMPLES
          Computation of the gamma function:

                  errno = 0;
                  y = gamma(x);
                  if(errno || (y > 88.0))
                          error();
                  y = signgam*exp(y);

     DIAGNOSTICS
          A large value (`HUGE') is returned for negative integer
          arguments and errno is set to EDOM.

     BUGS
          There should be a positive indication of error.
          The name should indicate the answer is a logarithm, perhaps
          lgamma.