Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

lgamma, lgammaf, lgammal, gamma, signgam - compute logarithm of gamma function

&pagelevel(4)&pagelevel

Syntax

#include <math.h>

double gamma(double x);
double lgamma(double x);

C11
float lgammaf(float x);
long double lgammal(long double x); (End)

extern int signgam;

Description

These functions compute the natural logarithm of the absolute value of the mathematical gamma function for a given floating-point number x:

The sign of this value is stored as +1 or -1 in the internal C variable signgam. The signgam variable must not be defined by the user.

Return val.

log(|tgamma(x)|)

if successful.


HUGE_VAL
HUGE_VALF
HUGE_VALL

depending on the function type, if the correct value results in an overflow.
errno is set to indicate the error.


HUGE_VAL
HUGE_VALF
HUGE_VALL

depending on the function type, if x is a non-positive integer.
errno is set to indicate the error.

Errors

gamma(), lgamma(), lgammaf() and lgammal() will fail if:


ERANGE

Overflow; the return value is too large.


EDOM

x is a non-positive integer.

See also

fabs(), tgamma(), math.h.