LGAMMA(3)

NAME
lgamma, gamma - log gamma function

SYNOPSIS
#include <math.h>
extern int
signgam;

double
lgamma(double x);
float
lgammaf(float x);

DESCRIPTION
Lgamma(x) returns ln|Γ(x)|.

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

IDIOSYNCRASIES
Do not use the expression “signgam*exp(lgamma(x))” to compute g := Γ(x). Instead use a program like this (in C):

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

Only after lgamma() has returned can signgam be correct.

RETURN VALUES
Lgamma() returns appropriate values unless an argument is out of range. Overflow will occur for sufficiently large positive values, and non-positive integers. On the VAX, the reserved operator is returned, and errno is set to ERANGE.

SEE ALSO
math(3)

HISTORY
The lgamma function appeared in 4.3BSD.