man.bsd.lv manual page server

Manual Page Search Parameters

LGAMMA(3) Library Functions Manual LGAMMA(3)

lgamma, lgammaf, lgamma_r, lgammaf_r, gamma, gammaf, gamma_r, gammaf_r, tgamma, tgammaflog gamma function

library “libm”

#include <math.h>

extern int signgam;


double
lgamma(double x);

float
lgammaf(float x);

double
lgamma_r(double x, int *sign);

float
lgammaf_r(float x, int *sign);

double
gamma(double x);

float
gammaf(float x);

double
gamma_r(double x, int *sign);

float
gammaf_r(float x, int *sign);

double
tgamma(double x);

float
tgammaf(float x);

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

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

() is a reentrant interface that performs identically to lgamma(), differing in that the sign of Γ(x) is stored in the location pointed to by the sign argument and signgam is not modified.

The (x) and (x) functions return Γ(x), with no effect on signgam.

(), (), (), and () are deprecated aliases for lgamma(), (), lgamma_r(), and (), respectively.

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 () has returned can signgam be correct.

lgamma() returns appropriate values unless an argument is out of range. Overflow will occur for sufficiently large positive values, and non-positive integers. For large non-integer negative values, tgamma() will underflow. On the VAX, the reserved operator is returned, and errno is set to ERANGE.

math(3)

The lgamma function appeared in 4.3BSD. The tgamma() function appeared in NetBSD 6.0.

May 4, 2012 NetBSD-9.2