


LGAMMA(3M)            MATHEMATICAL LIBRARY             LGAMMA(3M)



NAME
     lgamma - log gamma function

SYNOPSIS
     #include <math.h>

     extern int signgam;

     double lgamma(x)
     double x;

DESCRIPTION
     lgamma() returns
     lgamma returns ln|G(x)|.

     The external integer signgam returns the sign of G(x).

IDIOSYNCRASIES
     Do _n_o_t use the expression signgam*exp(lgamma(x)) to  compute
     `g := G(x)'.  Instead compute lgamma() first:
          lg = lgamma(x); g = signgam*exp(lg);

     only after lgamma() has returned  can  signgam  be  correct.
     Note:  G(x)  must overflow when _x is large enough, underflow
     when -_x is large enough, and generate  a  division  by  zero
     exception  at the singularities _x a nonpositive integer.  In
     addition, lgamma() may also set errno and call matherr(3M).

SEE ALSO
     matherr(3M)

























Sun Release 4.1   Last change: 22 November 1987                 1



