| title | GAMMA |
|---|---|
| language | en |
| description | Returns the Gamma function value of x. |
Returns the Gamma function value of x. The Gamma function is defined as Γ(x) = ∫₀^∞ t^(x-1)e^(-t)dt for x > 0, and extends to other real numbers through analytic continuation.
For positive integers, Γ(n) = (n-1)!
GAMMA(<x>)| Parameter | Description |
|---|---|
<x> |
The input value for which to compute the Gamma function |
Returns a value of type DOUBLE. Special cases:
- If the parameter is NULL, returns NULL
- If the parameter is a positive integer n, returns (n-1)!
- If the parameter is 0 or a negative integer, returns NaN
- For very large positive values, may return Infinity
SELECT gamma(5);+----------+
| gamma(5) |
+----------+
| 24 |
+----------+
SELECT gamma(3.5);+--------------------+
| gamma(3.5) |
+--------------------+
| 3.3233509704478426 |
+--------------------+
SELECT gamma(0.5);+--------------------+
| gamma(0.5) |
+--------------------+
| 1.7724538509055159 |
+--------------------+
SELECT gamma(-1);+-----------+
| gamma(-1) |
+-----------+
| nan |
+-----------+