Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ gamma(3M) — Reliant UNIX 5.44c4

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

isnan(3C)

exp(3M)

matherr(3M)

math(5)

values(5)

gamma(3M)                                                         gamma(3M)

NAME
     gamma, lgamma - log gamma function

SYNOPSIS
     cc [flag ...] file ... -lm [library ...]

     #include <math.h>

     double gamma(double x);

     double lgamma(double x);

     extern int signgam;

DESCRIPTION
     gamma() and lgamma() return loge(|gamma(x)|)

     where gamma(x) is defined as (see the Programmer's Reference Manual)

     int from 0 to inf e sup { - t } t sup { x - 1 } dt

     The sign of gamma(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 gamma:

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

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

RESULT
     For non-positive integer arguments HUGEVAL is returned and errno is
     set to EDOM. A message indicating SING error is printed on the stan-
     dard error output. If NaN is passed, NaN is returned, and errno is set
     to EDOM.

     If the correct value would overflow, gamma() and lgamma() return
     HUGEVAL and set errno to ERANGE.

SEE ALSO
     isnan(3C), exp(3M), matherr(3M), math(5), values(5).











Page 1                       Reliant UNIX 5.44                Printed 11/98

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