lgamma
You can use the lgamma function to compute the natural logarithm of the absolute value of
.
double_t lgamma (double_t x);
x
- Any positive floating-point number.
DESCRIPTION
The lgamma function computes the natural logarithm of the absolute value of
.
EXCEPTIONS
When x is finite and nonzero, either the result of
is exact or it raises one of the following exceptions:
- inexact (if the result must be rounded or an overflow occurs)
- overflow (if the result is outside the range of the data type)
- invalid (if x
0)
SPECIAL CASES
Table 10-38 shows the results when the argument to the lgamma function is a zero, a NaN, or an Infinity, plus other special cases for the lgamma function.
Special cases for the lgamma function
Operation | Result | Exceptions raised |
|
for x < 0 | NaN | Invalid |
|
| NaN | Invalid |
|
| NaN | Invalid |
|
| NaN | None[62] |
|
| + | Overflow |
|
| NaN | Invalid |
EXAMPLES
z = lgamma(-1.0); /* z = NAN. The invalid exception is
raised. */
z = lgamma(3.41); /* z = 1.10304. The inexact exception is
raised. */
[62] If the NaN is a signaling NaN, the invalid exception is raised.