Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

exp(3)

gamma(3)  —  Subroutines

OSF

NAME

lgamma, gamma − Computes the logarithm of the gamma function

LIBRARY

Math Library (libm.a)

SYNOPSIS

#include <math.h>

double gamma (
        double x );

double lgamma (
        double x );

extern int signgam;

PARAMETERS

xSpecifies some positive double value. 

DESCRIPTION

The gamma() and lgamma() functions return the logarithm of the absolute value of the gamma of x, where the gamma of x is defined as: ∞∫0e−ttx−1dt

The names lgamma() and gamma() are different names for the same function. 

The sign of the gamma of x is stored in the external integer variable signgam. The x parameter cannot be a nonpositive integer.  The gamma of x is defined over the reals, except the nonpositive integers. 

NOTES

Do not use the expression

g = signgam ∗ exp (lgamma (x))

to compute

g = gamma (x)

Instead, use the following sequence:

lg = lgamma (x);
g = signgam ∗ exp (lg);

This is because the C language does not specify evaluation order, and signgam is modified by the call to the lgamma() function. 

AES Support Level:
Trial use

RETURN VALUES

If the gamma() or lgamma() function fails, either INF or NaN is returned. 

RELATED INFORMATION

Functions: exp(3)

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