Important: The information in this document is obsolete and should not be used for new development.
gamma
You can use thegamma
function to perform .
double_t gamma (double_t x);
x
- Any positive floating-point number.
DESCRIPTION
Thegamma
function performs .
The
gamma
function reaches overflow very fast as x approaches + . For large values, use thelgamma
function (described in the next section) instead.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)
- invalid (if x is a negative integer)
- overflow (if the result is outside the range of the data type)
SPECIAL CASES
Table 10-37 shows the results when the argument to thegamma
function is a zero, a NaN, or an Infinity, plus other special cases for thegamma
function.
Special cases for the gamma
functionOperation Result Exceptions raised for negative integer x NaN Invalid NaN Invalid NaN Invalid NaN None[61] + Overflow NaN Invalid EXAMPLES
z = gamma(-1.0); /* z = NAN. The invalid exception is raised. */ z = gamma(6); /* z = 120 */
[61] If the NaN is a signaling NaN, the invalid exception is raised.