Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

exp(3M)

matherr(3M)

values(5)

gamma(3M)

NAME

gamma, lgamma − log gamma function

SYNOPSIS

#include <math.h>

double gamma (x)
double x;

double lgamma (x)
double x;

extern int signgam;

DESCRIPTION

GAMMA returns ln ( |GAMMA(x)| ), where GAMMA(x) is defined as Integral [0, infinity] (e∗∗(-t) ∗ t∗∗(x-t)) 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(x):

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

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

DIAGNOSTICS

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

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

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

SEE ALSO

exp(3M), matherr(3M), values(5). 

CX/UX Programmer’s Reference Manual

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