From 7baf12b74af590f9175778add7e6cf285fadabc6 Mon Sep 17 00:00:00 2001 From: tommyhugh2333-rgb Date: Wed, 4 Feb 2026 16:40:00 +0800 Subject: [PATCH] [docs] Add documentation for GAMMA function --- .../numeric-functions/gamma.md | 82 +++++++++++++++++++ .../numeric-functions/gamma.md | 82 +++++++++++++++++++ 2 files changed, 164 insertions(+) create mode 100644 docs/sql-manual/sql-functions/scalar-functions/numeric-functions/gamma.md create mode 100644 i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/numeric-functions/gamma.md diff --git a/docs/sql-manual/sql-functions/scalar-functions/numeric-functions/gamma.md b/docs/sql-manual/sql-functions/scalar-functions/numeric-functions/gamma.md new file mode 100644 index 0000000000000..afe8bc81c8ad9 --- /dev/null +++ b/docs/sql-manual/sql-functions/scalar-functions/numeric-functions/gamma.md @@ -0,0 +1,82 @@ +--- +{ + "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 + +```sql +GAMMA() +``` + +## Parameters + +| Parameter | Description | +| -- | -- | +| `` | 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 + +```sql +SELECT gamma(5); +``` + +```text ++----------+ +| gamma(5) | ++----------+ +| 24 | ++----------+ +``` + +```sql +SELECT gamma(3.5); +``` + +```text ++--------------------+ +| gamma(3.5) | ++--------------------+ +| 3.3233509704478426 | ++--------------------+ +``` + +```sql +SELECT gamma(0.5); +``` + +```text ++--------------------+ +| gamma(0.5) | ++--------------------+ +| 1.7724538509055159 | ++--------------------+ +``` + +```sql +SELECT gamma(-1); +``` + +```text ++-----------+ +| gamma(-1) | ++-----------+ +| nan | ++-----------+ \ No newline at end of file diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/numeric-functions/gamma.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/numeric-functions/gamma.md new file mode 100644 index 0000000000000..799d1aa46fcbf --- /dev/null +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/numeric-functions/gamma.md @@ -0,0 +1,82 @@ +--- +{ + "title": "GAMMA", + "language": "zh-CN", + "description": "返回 x 的 Gamma 函数值。" +} +--- + +## 描述 + +返回 `x` 的 Gamma 函数值。Gamma 函数定义为 `Γ(x) = ∫₀^∞ t^(x-1)e^(-t)dt`(当 x > 0),并通过解析延拓扩展到其他实数。 + +对于正整数,`Γ(n) = (n-1)!` + +## 语法 + +```sql +GAMMA() +``` + +## 参数 + +| 参数 | 说明 | +| -- | -- | +| `` | 用于计算 Gamma 函数的输入值 | + +## 返回值 + +返回一个 DOUBLE 类型的值。特殊情况: +- 当参数为 NULL 时,返回 NULL +- 当参数为正整数 n 时,返回 (n-1)! +- 当参数为 0 或负整数时,返回 NaN +- 对于非常大的正值,可能返回 Infinity + +## 举例 + +```sql +SELECT gamma(5); +``` + +```text ++----------+ +| gamma(5) | ++----------+ +| 24 | ++----------+ +``` + +```sql +SELECT gamma(3.5); +``` + +```text ++--------------------+ +| gamma(3.5) | ++--------------------+ +| 3.3233509704478426 | ++--------------------+ +``` + +```sql +SELECT gamma(0.5); +``` + +```text ++--------------------+ +| gamma(0.5) | ++--------------------+ +| 1.7724538509055159 | ++--------------------+ +``` + +```sql +SELECT gamma(-1); +``` + +```text ++-----------+ +| gamma(-1) | ++-----------+ +| nan | ++-----------+ \ No newline at end of file