Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ gamma(S) — OpenDesktop Software Development System 3.0.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

cc(CP)

exp(S)

matherr(S)

values(M)


 gamma(S)                       6 January 1993                       gamma(S)


 Name

    gamma - log gamma function

 Syntax


    cc  . . .  -lm


    #include  <math.h>

    double gamma (x)
    double x;

    double lgamma (x)
    double x;

    extern int signgam;


 Description

    The gamma and lgamma functions both return ln(|<GAMMA>(x)|), where

                  <infinity>
       <GAMMA>(x)=<integral>e-ttx-1dt.
                      0
    The sign of <GAMMA>(x) is returned in the external integer signgam.  The
    lgamma routine simply calls gamma, but is only available when the cc
    -xpg3 option is specified to obtain compliant XPG3 code.  The argument x
    may not be a non-positive integer.

    _________________________________________________________________________
       NOTE  Some Greek and mathematical characters, on this manual page,
       are not representable on some terminals.  See the corresponding
       printed manual page in the Programmer's Reference Manual Volume 2.
    _________________________________________________________________________


    The following C program fragment might be used to calculate <GAMMA>:

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

    where LNMAXDOUBLE is the least value that causes exp(S) to return a
    range error, and is defined in the <values.h> header file.

 See also

    cc(CP), exp(S), matherr(S), values(M)

 Diagnostics

    For non-negative integer arguments HUGE is returned, and errno is set to
    EDOM.  A message indicating SING error is printed on the standard error
    output [for example, gamma (-5.0)].

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

    These error-handling procedures can be changed with the function
    matherr(S).

 Standards conformance

    gamma is conformant with:
    AT&T SVID Issue 2;
    and X/Open Portability Guide, Issue 3, 1989.


Typewritten Software • bear@typewritten.org • Edmonds, WA 98026