Unix/Linux Go Back    

RedHat 9 (Linux i386) - man page for lgamma (redhat section 3)

Linux & Unix Commands - Search Man Pages
Man Page or Keyword Search:   man
Select Man Page Set:       apropos Keyword Search (sections above)

LGAMMA(3)			    Linux Programmer's Manual				LGAMMA(3)

       lgamma - log gamma function

       #include <math.h>

       double lgamma(double x);
       float lgammaf(float x);
       long double lgammal(long double x);

       double lgamma_r(double x, int *signp);
       float lgammaf_r(float x, int *signp);
       long double lgammal_r(long double x, int *signp);

       The Gamma function is defined by

	Gamma(x) = integral from 0 to infinity of t^(x-1) e^-t dt

       It  is  defined	for  every  real number except for nonpositive integers.  For nonnegative
       integral m one has

	Gamma(m+1) = m!

       and, more generally, for all x:

	Gamma(x+1) = x * Gamma(x)

       For x < 0.5 one can use

	Gamma(x) * Gamma(1-x) = PI/sin(PI*x)

       The lgamma() function returns the natural logarithm of the absolute  value  of  the  Gamma
       function.   The	sign  of  the  Gamma function is returned in the external integer signgam
       declared in <math.h>.  It is 1 when the Gamma function is positive or zero, -1 when it  is

       Since  using a constant location signgam is not thread-safe, the functions lgamma_r() etc.
       have been introduced; they return this sign via the parameter signp.

       For nonpositive integer values of x, lgamma() returns HUGE_VAL, sets errno to  ERANGE  and
       raises  the  zero divide exception.  (Similarly, lgammaf() returns HUGE_VALF and lgammal()
       returns HUGE_VALL.)

       An application wishing to check for error situations should set errno  to  zero	and  call
       feclearexcept(FE_ALL_EXCEPT)  before  calling these functions. On return, if errno is non-
       zero or fetestexcept(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW) is	non-zero,
       an error has occurred.

       ERANGE Invalid argument - nonpositive integer value of x.

       C99, SVID 3, BSD 4.3


					    2002-08-10					LGAMMA(3)
Unix & Linux Commands & Man Pages : ©2000 - 2018 Unix and Linux Forums

All times are GMT -4. The time now is 04:30 PM.