


      GAMMA(3M)			  (UNIX	5.0)		      GAMMA(3M)



      NAME
	   gamma - log gamma function

      SYNTAX
	   #include <math.h>

	   extern int signgam;

	   double gamma	(x)
	   double x;

      DESCRIPTION
	   Gamma returns ln(|G(x)|), where G(x)	is defined as
	   oo -t x-1
	   ^ e	t   dt.	 The sign of G(x) is returned in the external
	   integer signgam.  The argument x may	not be a non-positive
	   integer.

	   The following C program fragment might be used to calculate
	   G:

		if ((y = gamma(x)) > LOGHUGE)
		     error();
		y = signgam * exp(y);

	   where LOGHUGE is the	least value that causes	exp(3M)	to
	   return a range error.

      DIAGNOSTICS
	   For non-negative integer arguments HUGE is returned,	and
	   errno is set	to EDOM.  A message indicating DOMAIN error is
	   printed on the standard error output.

	   If the correct value	would overflow,	gamma returns HUGE and
	   sets	errno to ERANGE.

	   These error-handling	procedures may be changed with the
	   function matherr(3M).

      SEE ALSO
	   exp(3M), matherr(3M).














      Page 1					     (73 A2 02MTA REV1)



