Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ gamma(3M) — SunOS 4.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

matherr(3M)

LGAMMA(3M)  —  MATHEMATICAL LIBRARY

NAME

lgamma − log gamma function

SYNOPSIS

#include <math.h>

extern int signgam;

double lgamma(x)
double x;

DESCRIPTION

lgamma() returns

ln|Γ(x)|
where
Γ(x) = ∫0s10∞tx−1e−tdt
for x > 0 and
Γ(x) = π/(Γ(1−x)sin(πx))
for x < 1.

The external integer signgam returns the sign of Γ(x). 

IDIOSYNCRASIES

Do not use the expression signgam∗exp(lgamma(x)) to compute ‘g := Γ(x)’.  Instead compute lgamma() first:

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

only after lgamma() has returned can signgam be correct.  Note: Γ(x) must overflow when x is large enough, underflow when −x is large enough, and generate a division by zero exception at the singularities x a nonpositive integer.  In addition, lgamma() may also set errno and call matherr(3M). 

SEE ALSO

matherr(3M)

Sun Release 4.0  —  Last change: 22 November 1987

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