Switch to SpeakEasy.net DSL

The Modular Manual Browser

Home Page
Manual: (Debian-5.0)
Apropos / Subsearch:
optional field

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

       lgamma, lgammaf, lgammal, lgamma_r, lgammaf_r, lgammal_r, signgam - log
       gamma function

       #include <&lt;math.h>&gt;

       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);

       extern int signgam;

       Link with -lm.

   Feature Test Macro Requirements for glibc (see feature_test_macros(7)):

       lgamma(), lgammaf(), lgammal(): _BSD_SOURCE || _SVID_SOURCE ||
       _XOPEN_SOURCE || _ISOC99_SOURCE; or cc -std=c99
       lgamma_r(), lgammaf_r(), lgammal_r(): _BSD_SOURCE || _SVID_SOURCE
       signgam: _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE

       For the definition of the Gamma function, see tgamma(3).

       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 &lt;math.h&gt;.  It is 1
       when the Gamma function is positive or zero, -1 when it is negative.

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

       For non-positive 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.)

       In order to check for errors, set errno to  zero  and  call  feclearex-
       cept(FE_ALL_EXCEPT)  before  calling  these  functions.   On return, if
       errno is non-zero or fetestexcept(FE_INVALID | FE_DIVBYZERO |  FE_OVER-
       FLOW | FE_UNDERFLOW) is non-zero, an error has occurred.

       A  range error occurs if x is too large.  A pole error occurs if x is a
       negative integer or zero.

       The lgamma() functions are specified in C99 and POSIX.1-2001.   signgam
       is specified in POSIX.1-2001, but not in C99.  The lgamma_r() functions
       are non-standard, but present on several other systems.


       This page is part of release 3.05 of the Linux  man-pages  project.   A
       description  of  the project, and information about reporting bugs, can
       be found at http://www.kernel.org/doc/man-pages/.

                                  2007-07-26                         LGAMMA(3)