NAME | SYNOPSIS | API RESTRICTIONS | DESCRIPTION | EXCEPTIONS | RETURN VALUES | ATTRIBUTES | SEE ALSO | NOTES
$(NUCLEUS_DIR)/lib/libm.a #include <math.h> extern int signgam;double lgamma(double x);
The function or functions documented here may not be used safely in all application contexts with all APIs provided in the ChorusOS 5.0 product.
See API(5FEA) for details.
lgamma x() returns:
ln ||~( x )|
where
|~( x ) = integral from 0 to +[infin ] of pow(t, x -1)*exp(-t) dt for x > 0
and
|~( x ) = Pi/(|~(1- x )sin(pi* x )) for x < 0
The external integer signgam returns the sign of |~( x ) .
gamma x() returns |~( x ) , with no effect on signgam .
To compute g := |~( x ) , do not use the expression:
signgam*exp(lgamma( x ))
Instead, use a program like this (in C):
lg = lgamma(x); g = signgam*exp(lg);
signgam will be correct only after lgamma() has returned.
For arguments within its range, gamma() is preferable to lgamma() , as it is accurate to within one unit in the last place for positive arguments. Exponentiation of lgamma() will lose up to 10 significant bits.
The lgamma() function is not thread safe.
The gamma() and lgamma() functions return appropriate values unless an argument is out of range. Overflow will occur for sufficiently large positive values and non-positive integers. In this case, infinity is returned, errno is set to ERANGE , and a system-dependent notification is performed. For large non-integer negative values, gamma() will underflow.
See attributes(5) for descriptions of the following attributes:
ATTRIBUTE TYPE | ATTRIBUTE VALUE |
---|---|
Interface Stability | Evolving |
As signgam is a global variable, this routine is not re-entrant.
NAME | SYNOPSIS | API RESTRICTIONS | DESCRIPTION | EXCEPTIONS | RETURN VALUES | ATTRIBUTES | SEE ALSO | NOTES