Skip to content

Latest commit

 

History

History
82 lines (64 loc) · 1.31 KB

File metadata and controls

82 lines (64 loc) · 1.31 KB
title GAMMA
language en
description Returns the Gamma function value of x.

Description

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)!

Syntax

GAMMA(<x>)

Parameters

Parameter Description
<x> The input value for which to compute the Gamma function

Return Value

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

Examples

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 |
+-----------+