This is an automated email from the ASF dual-hosted git repository.
zclll pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris-website.git
The following commit(s) were added to refs/heads/master by this push:
new 69d51573731 [doc] Clarify the behavior of certain mathematical
functions for invalid inputs. (#2857)
69d51573731 is described below
commit 69d51573731a6ca3656f9365c6dbe83420524555
Author: Mryange <[email protected]>
AuthorDate: Tue Sep 16 11:38:43 2025 +0800
[doc] Clarify the behavior of certain mathematical functions for invalid
inputs. (#2857)
## Versions
- [x] dev
- [ ] 3.0
- [ ] 2.1
- [ ] 2.0
## Languages
- [x] Chinese
- [x] English
## Docs Checklist
- [ ] Checked by AI
- [ ] Test Cases Built
---
.../scalar-functions/numeric-functions/acos.md | 66 ++++++++++++-
.../scalar-functions/numeric-functions/acosh.md | 59 +++++++++--
.../scalar-functions/numeric-functions/asin.md | 88 +++++++++++++++--
.../scalar-functions/numeric-functions/atanh.md | 63 +++++++++---
.../scalar-functions/numeric-functions/sqrt.md | 107 ++++++++++++++++++--
.../scalar-functions/numeric-functions/acos.md | 72 ++++++++++++--
.../scalar-functions/numeric-functions/acosh.md | 54 +++++++++-
.../scalar-functions/numeric-functions/asin.md | 87 ++++++++++++++--
.../scalar-functions/numeric-functions/atanh.md | 58 ++++++++---
.../scalar-functions/numeric-functions/sqrt.md | 109 +++++++++++++++++++--
10 files changed, 677 insertions(+), 86 deletions(-)
diff --git
a/docs/sql-manual/sql-functions/scalar-functions/numeric-functions/acos.md
b/docs/sql-manual/sql-functions/scalar-functions/numeric-functions/acos.md
index 7ab807f309f..6436576c834 100644
--- a/docs/sql-manual/sql-functions/scalar-functions/numeric-functions/acos.md
+++ b/docs/sql-manual/sql-functions/scalar-functions/numeric-functions/acos.md
@@ -19,13 +19,23 @@ ACOS(<x>)
| Parameter | Description |
| -- | -- |
-| `<x>` | The value for which the acos value is to be calculated |
+| `<x>` | The value for which the arc cosine is to be calculated |
## Return Value
-The acos value of parameter `x`.
+The arc cosine value of parameter `x`, expressed in radians.
-## Example
+## Special Cases
+
+- When `x` equals 1, returns 0
+- When `x` equals 0, returns π/2
+- When `x` equals -1, returns π
+- When `x` is not in the range [-1, 1], returns `NULL`
+- When `x` is NaN, returns NaN
+- When `x` is positive or negative infinity, returns `NULL`
+- When `x` is NULL, returns NULL
+
+## Examples
```sql
select acos(1);
@@ -51,6 +61,18 @@ select acos(0);
+--------------------+
```
+```sql
+select acos(-1);
+```
+
+```text
++--------------------+
+| acos(-1.0) |
++--------------------+
+| 3.141592653589793 |
++--------------------+
+```
+
```sql
select acos(-2);
```
@@ -59,6 +81,42 @@ select acos(-2);
+------------+
| acos(-2.0) |
+------------+
-| nan |
+| NULL |
+------------+
```
+
+```sql
+select acos(1.0000001);
+```
+
+```text
++-----------------+
+| acos(1.0000001) |
++-----------------+
+| NULL |
++-----------------+
+```
+
+```sql
+select acos(cast('nan' as double));
+```
+
+```text
++---------------------------+
+| acos(cast('nan' AS DOUBLE)) |
++---------------------------+
+| NaN |
++---------------------------+
+```
+
+```sql
+select acos(cast('inf' as double));
+```
+
+```text
++---------------------------+
+| acos(cast('inf' AS DOUBLE)) |
++---------------------------+
+| NULL |
++---------------------------+
+```
diff --git
a/docs/sql-manual/sql-functions/scalar-functions/numeric-functions/acosh.md
b/docs/sql-manual/sql-functions/scalar-functions/numeric-functions/acosh.md
index b4722a54f43..34a1abd99fe 100644
--- a/docs/sql-manual/sql-functions/scalar-functions/numeric-functions/acosh.md
+++ b/docs/sql-manual/sql-functions/scalar-functions/numeric-functions/acosh.md
@@ -19,19 +19,28 @@ ACOSH(<x>)
| Parameter | Description |
| -- | -- |
-| `<x>` | The value for which the hyperbolic arc cosine value is to be
calculated |
+| `<x>` | The value for which the hyperbolic arc cosine is to be calculated |
## Return Value
-The acosh value of parameter `x`.
+The hyperbolic arc cosine value of parameter `x`.
-## Example
+## Special Cases
+
+- When `x` equals 1, returns 0
+- When `x` is less than 1, returns `NULL`
+- When `x` is NaN, returns NaN
+- When `x` is positive infinity, returns Infinity
+- When `x` is negative infinity, returns `NULL`
+- When `x` is NULL, returns NULL
+
+## Examples
```sql
select acosh(0.0);
```
-```sql
+```text
+------------+
| acosh(0.0) |
+------------+
@@ -43,7 +52,7 @@ select acosh(0.0);
select acosh(-1.0);
```
-```sql
+```text
+-------------+
| acosh(-1.0) |
+-------------+
@@ -55,7 +64,7 @@ select acosh(-1.0);
select acosh(1.0);
```
-```sql
+```text
+------------+
| acosh(1.0) |
+------------+
@@ -64,10 +73,46 @@ select acosh(1.0);
```
```sql
-select acosh(10.0);
+select acosh(1.0000001);
+```
+
+```text
++-------------------------+
+| acosh(1.0000001) |
++-------------------------+
+| 0.0004472135918947727 |
++-------------------------+
```
```sql
+select acosh(cast('nan' as double));
+```
+
+```text
++----------------------------+
+| acosh(cast('nan' AS DOUBLE)) |
++----------------------------+
+| NaN |
++----------------------------+
+```
+
+```sql
+select acosh(cast('inf' as double));
+```
+
+```text
++----------------------------+
+| acosh(cast('inf' AS DOUBLE)) |
++----------------------------+
+| Infinity |
++----------------------------+
+```
+
+```sql
+select acosh(10.0);
+```
+
+```text
+-------------------+
| acosh(10.0) |
+-------------------+
diff --git
a/docs/sql-manual/sql-functions/scalar-functions/numeric-functions/asin.md
b/docs/sql-manual/sql-functions/scalar-functions/numeric-functions/asin.md
index 121d90b510c..f62ccf6289a 100644
--- a/docs/sql-manual/sql-functions/scalar-functions/numeric-functions/asin.md
+++ b/docs/sql-manual/sql-functions/scalar-functions/numeric-functions/asin.md
@@ -7,7 +7,7 @@
## Description
-Returns the arc sine of `x`, or `nan` if `x` is not in the range `-1` to `1`.
+Returns the arc sine of `x`, or `NULL` if `x` is not in the range `-1` to `1`.
## Syntax
@@ -19,13 +19,23 @@ ASIN(<x>)
| Parameter | Description |
| -- | -- |
-| `<x>` | The value for which the asin value is to be calculated |
+| `<x>` | The value for which the arc sine is to be calculated |
## Return Value
-The asin value of parameter `x`.
+The arc sine value of parameter `x`, expressed in radians.
-## Example
+## Special Cases
+
+- When `x` equals 0, returns 0
+- When `x` equals 1, returns π/2
+- When `x` equals -1, returns -π/2
+- When `x` is not in the range [-1, 1], returns `NULL`
+- When `x` is NaN, returns NaN
+- When `x` is positive or negative infinity, returns `NULL`
+- When `x` is NULL, returns NULL
+
+## Examples
```sql
select asin(0.5);
@@ -39,14 +49,74 @@ select asin(0.5);
+---------------------+
```
+```sql
+select asin(0.0);
+```
+
+```text
++------------+
+| asin(0.0) |
++------------+
+| 0 |
++------------+
+```
+
+```sql
+select asin(1.0);
+```
+
+```text
++--------------------+
+| asin(1.0) |
++--------------------+
+| 1.570796326794897 |
++--------------------+
+```
+
+```sql
+select asin(-1.0);
+```
+
+```text
++---------------------+
+| asin(-1.0) |
++---------------------+
+| -1.570796326794897 |
++---------------------+
+```
+
```sql
select asin(2);
```
```text
-+-----------+
-| asin(2.0) |
-+-----------+
-| nan |
-+-----------+
++------------+
+| asin(2.0) |
++------------+
+| NULL |
++------------+
+```
+
+```sql
+select asin(cast('nan' as double));
+```
+
+```text
++---------------------------+
+| asin(cast('nan' AS DOUBLE)) |
++---------------------------+
+| NaN |
++---------------------------+
+```
+
+```sql
+select asin(cast('inf' as double));
+```
+
+```text
++---------------------------+
+| asin(cast('inf' AS DOUBLE)) |
++---------------------------+
+| NULL |
++---------------------------+
```
diff --git
a/docs/sql-manual/sql-functions/scalar-functions/numeric-functions/atanh.md
b/docs/sql-manual/sql-functions/scalar-functions/numeric-functions/atanh.md
index 6e8ba1d28ad..81f74b72504 100644
--- a/docs/sql-manual/sql-functions/scalar-functions/numeric-functions/atanh.md
+++ b/docs/sql-manual/sql-functions/scalar-functions/numeric-functions/atanh.md
@@ -7,7 +7,7 @@
## Description
-Returns the hyperbolic arc tangent of `x`, or `NULL` if `x` is not in the
range `-1` to `1`(excluding `-1` and `1`).
+Returns the hyperbolic arc tangent of `x`, or `NULL` if `x` is not in the
range `-1` to `1` (excluding `-1` and `1`).
## Syntax
@@ -19,31 +19,40 @@ ATANH(<x>)
| Parameter | Description |
| -- | -- |
-| `<x>` | The value for which the hyperbolic arc tangent value is to be
calculated |
+| `<x>` | The value for which the hyperbolic arc tangent is to be calculated |
## Return Value
-The atanh value of parameter `x`.
+The hyperbolic arc tangent value of parameter `x`.
-## Example
+## Special Cases
+
+- When `x` equals 0, returns 0
+- When `x` equals 1 or -1, returns `NULL`
+- When `x` is outside the range (-1, 1), returns `NULL`
+- When `x` is NaN, returns NaN
+- When `x` is positive or negative infinity, returns `NULL`
+- When `x` is NULL, returns NULL
+
+## Examples
```sql
-select atanh(1.0);
+select atanh(0.0);
```
-```sql
+```text
+------------+
-| atanh(1.0) |
+| atanh(0.0) |
+------------+
-| NULL |
+| 0 |
+------------+
```
```sql
-select atanh(1.0);
+select atanh(-1.0);
```
-```sql
+```text
+-------------+
| atanh(-1.0) |
+-------------+
@@ -55,22 +64,46 @@ select atanh(1.0);
select atanh(1.0);
```
-```sql
+```text
+------------+
-| atanh(0.0) |
+| atanh(1.0) |
+------------+
-| 0 |
+| NULL |
+------------+
```
```sql
-select atanh(1.0);
+select atanh(0.5);
```
-```sql
+```text
+--------------------+
| atanh(0.5) |
+--------------------+
| 0.5493061443340548 |
+--------------------+
```
+
+```sql
+select atanh(cast('nan' as double));
+```
+
+```text
++---------------------------+
+| atanh(cast('nan' AS DOUBLE)) |
++---------------------------+
+| NaN |
++---------------------------+
+```
+
+```sql
+select atanh(cast('inf' as double));
+```
+
+```text
++---------------------------+
+| atanh(cast('inf' AS DOUBLE)) |
++---------------------------+
+| NULL |
++---------------------------+
+```
diff --git
a/docs/sql-manual/sql-functions/scalar-functions/numeric-functions/sqrt.md
b/docs/sql-manual/sql-functions/scalar-functions/numeric-functions/sqrt.md
index 4a4984c7d05..f51dcdd7aa6 100644
--- a/docs/sql-manual/sql-functions/scalar-functions/numeric-functions/sqrt.md
+++ b/docs/sql-manual/sql-functions/scalar-functions/numeric-functions/sqrt.md
@@ -9,35 +9,126 @@
Returns the square root of a value, where the input value must be greater than
or equal to 0.
-## Aliases
-
-- DSQRT
-
## Syntax
```sql
-SQRT(<a>)
+SQRT(<x>)
```
## Parameters
| Parameter | Description |
| -- | -- |
-| `<a>` | The value whose square root is to be calculated |
+| `<x>` | The value whose square root is to be calculated |
## Return Value
-The square root of parameter a.
+The square root of parameter `x`.
+
+## Special Cases
+
+- When `x` equals 0, returns 0
+- When `x` equals -0, returns -0
+- When `x` is less than 0, returns `NULL`
+- When `x` is NaN, returns NaN
+- When `x` is positive infinity, returns Infinity
+- When `x` is negative infinity, returns `NULL`
+- When `x` is NULL, returns NULL
## Examples
```sql
-select sqrt(9),sqrt(2)
+select sqrt(9), sqrt(2);
```
+
```text
+-------------------------+-------------------------+
| sqrt(cast(9 as DOUBLE)) | sqrt(cast(2 as DOUBLE)) |
+-------------------------+-------------------------+
| 3.0 | 1.4142135623730951 |
+-------------------------+-------------------------+
+```
+
+```sql
+select sqrt(1.0);
+```
+
+```text
++------------+
+| sqrt(1.0) |
++------------+
+| 1 |
++------------+
+```
+
+```sql
+select sqrt(0.0);
+```
+
+```text
++------------+
+| sqrt(0.0) |
++------------+
+| 0 |
++------------+
+```
+
+```sql
+select sqrt(-0.0);
+```
+
+```text
++-------------+
+| sqrt(-0.0) |
++-------------+
+| -0 |
++-------------+
+```
+
+```sql
+select sqrt(-1.0);
+```
+
+```text
++-------------+
+| sqrt(-1.0) |
++-------------+
+| NULL |
++-------------+
+```
+
+```sql
+select sqrt(cast('nan' as double));
+```
+
+```text
++---------------------------+
+| sqrt(cast('nan' AS DOUBLE)) |
++---------------------------+
+| NaN |
++---------------------------+
+```
+
+```sql
+select sqrt(cast('inf' as double));
+```
+
+```text
++---------------------------+
+| sqrt(cast('inf' AS DOUBLE)) |
++---------------------------+
+| Infinity |
++---------------------------+
+```
+
+```sql
+select sqrt(cast('-inf' as double));
+```
+
+```text
++----------------------------+
+| sqrt(cast('-inf' AS DOUBLE)) |
++----------------------------+
+| NULL |
++----------------------------+
```
\ 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/acos.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/numeric-functions/acos.md
index 45e759f2e1c..251e9d23d1e 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/numeric-functions/acos.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/numeric-functions/acos.md
@@ -7,7 +7,7 @@
## 描述
-返回`x`的反余弦值,若 `x`不在`-1`到 `1`的范围之内,则返回 `nan`.
+计算 `x` 的反余弦值。若参数 `x` 不在 `-1` 到 `1` 的范围之内,则返回 `NULL`。
## 语法
@@ -17,15 +17,25 @@ ACOS(<x>)
## 参数
-| 参数 | 说明 |
-| -- | -- |
-| `<x>` | 需要被计算反余弦的值 |
+| 参数 | 描述 |
+| --- | --- |
+| `<x>` | 要计算反余弦值的数值 |
## 返回值
-参数 x 的反余弦值
+返回 `x` 的反余弦值,结果以弧度表示。
-## 举例
+## 特殊情况处理
+
+- 当 `x` 等于 1 时,返回 0
+- 当 `x` 等于 0 时,返回 π/2
+- 当 `x` 等于 -1 时,返回 π
+- 当 `x` 不在 [-1, 1] 范围内时,返回 `NULL`
+- 当 `x` 为 NaN 时,返回 NaN
+- 当 `x` 为正无穷大或负无穷大时,返回 `NULL`
+- 当 `x` 为 NULL 时,返回 NULL
+
+## 示例
```sql
select acos(1);
@@ -51,6 +61,18 @@ select acos(0);
+--------------------+
```
+```sql
+select acos(-1);
+```
+
+```text
++--------------------+
+| acos(-1.0) |
++--------------------+
+| 3.141592653589793 |
++--------------------+
+```
+
```sql
select acos(-2);
```
@@ -59,6 +81,42 @@ select acos(-2);
+------------+
| acos(-2.0) |
+------------+
-| nan |
+| NULL |
+------------+
```
+
+```sql
+select acos(1.0000001);
+```
+
+```text
++-----------------+
+| acos(1.0000001) |
++-----------------+
+| NULL |
++-----------------+
+```
+
+```sql
+select acos(cast('nan' as double));
+```
+
+```text
++---------------------------+
+| acos(cast('nan' AS DOUBLE)) |
++---------------------------+
+| NaN |
++---------------------------+
+```
+
+```sql
+select acos(cast('inf' as double));
+```
+
+```text
++---------------------------+
+| acos(cast('inf' AS DOUBLE)) |
++---------------------------+
+| NULL |
++---------------------------+
+```
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/numeric-functions/acosh.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/numeric-functions/acosh.md
index b9c61d588dd..b57bb3ae4d6 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/numeric-functions/acosh.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/numeric-functions/acosh.md
@@ -9,7 +9,6 @@
返回`x`的反双曲余弦值。如果`x`小于`1`,则返回`NULL`。
-
## 语法
```sql
@@ -26,13 +25,22 @@ ACOSH(<x>)
参数`x`的反双曲余弦值。
+## 特殊情况处理
+
+- 当 `x` 等于 1 时,返回 0
+- 当 `x` 小于 1 时,返回 `NULL`
+- 当 `x` 为 NaN 时,返回 NaN
+- 当 `x` 为正无穷大时,返回 Infinity
+- 当 `x` 为负无穷大时,返回 `NULL`
+- 当 `x` 为 NULL 时,返回 NULL
+
## 示例
```sql
select acosh(0.0);
```
-```sql
+```text
+------------+
| acosh(0.0) |
+------------+
@@ -44,7 +52,7 @@ select acosh(0.0);
select acosh(-1.0);
```
-```sql
+```text
+-------------+
| acosh(-1.0) |
+-------------+
@@ -56,7 +64,7 @@ select acosh(-1.0);
select acosh(1.0);
```
-```sql
+```text
+------------+
| acosh(1.0) |
+------------+
@@ -65,10 +73,46 @@ select acosh(1.0);
```
```sql
-select acosh(10.0);
+select acosh(1.0000001);
+```
+
+```text
++-------------------------+
+| acosh(1.0000001) |
++-------------------------+
+| 0.0004472135918947727 |
++-------------------------+
+```
+
+```sql
+select acosh(cast('nan' as double));
+```
+
+```text
++----------------------------+
+| acosh(cast('nan' AS DOUBLE)) |
++----------------------------+
+| NaN |
++----------------------------+
```
```sql
+select acosh(cast('inf' as double));
+```
+
+```text
++----------------------------+
+| acosh(cast('inf' AS DOUBLE)) |
++----------------------------+
+| Infinity |
++----------------------------+
+```
+
+```sql
+select acosh(10.0);
+```
+
+```text
+-------------------+
| acosh(10.0) |
+-------------------+
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/numeric-functions/asin.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/numeric-functions/asin.md
index e391a44d285..d91164f2c5e 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/numeric-functions/asin.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/numeric-functions/asin.md
@@ -7,7 +7,7 @@
## 描述
-返回`x`的反正弦值,若 `x`不在`-1`到 `1`的范围之内,则返回 `nan`.
+返回`x`的反正弦值。若参数 `x`不在`-1`到 `1`的范围之内,则返回 `NULL`。
## 语法
@@ -17,16 +17,25 @@ ASIN(<x>)
## 参数
-| 参数 | 说明 |
+| 参数 | 描述 |
| -- | -- |
| `<x>` | 需要被计算反正弦的值 |
## 返回值
-参数 x 的反正弦值
+参数 x 的反正弦值,结果以弧度表示。
+## 特殊情况处理
-## 举例
+- 当 `x` 等于 0 时,返回 0
+- 当 `x` 等于 1 时,返回 π/2
+- 当 `x` 等于 -1 时,返回 -π/2
+- 当 `x` 不在 [-1, 1] 范围内时,返回 `NULL`
+- 当 `x` 为 NaN 时,返回 NaN
+- 当 `x` 为正无穷大或负无穷大时,返回 `NULL`
+- 当 `x` 为 NULL 时,返回 NULL
+
+## 示例
```sql
select asin(0.5);
@@ -40,14 +49,74 @@ select asin(0.5);
+---------------------+
```
+```sql
+select asin(0.0);
+```
+
+```text
++------------+
+| asin(0.0) |
++------------+
+| 0 |
++------------+
+```
+
+```sql
+select asin(1.0);
+```
+
+```text
++--------------------+
+| asin(1.0) |
++--------------------+
+| 1.570796326794897 |
++--------------------+
+```
+
+```sql
+select asin(-1.0);
+```
+
+```text
++---------------------+
+| asin(-1.0) |
++---------------------+
+| -1.570796326794897 |
++---------------------+
+```
+
```sql
select asin(2);
```
```text
-+-----------+
-| asin(2.0) |
-+-----------+
-| nan |
-+-----------+
++------------+
+| asin(2.0) |
++------------+
+| NULL |
++------------+
+```
+
+```sql
+select asin(cast('nan' as double));
+```
+
+```text
++---------------------------+
+| asin(cast('nan' AS DOUBLE)) |
++---------------------------+
+| NaN |
++---------------------------+
+```
+
+```sql
+select asin(cast('inf' as double));
+```
+
+```text
++---------------------------+
+| asin(cast('inf' AS DOUBLE)) |
++---------------------------+
+| NULL |
++---------------------------+
```
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/numeric-functions/atanh.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/numeric-functions/atanh.md
index 2c1faee1c85..830616543ff 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/numeric-functions/atanh.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/numeric-functions/atanh.md
@@ -7,8 +7,7 @@
## 描述
-返回`x`的反双曲正切值。如果`x`不在`-1`到`1`之间(不包括`-1`和`1`),则返回`NULL`。
-
+返回`x`的反双曲正切值。如果`x`不在`-1`到`1`之间 (不包括`-1`和`1`),则返回`NULL`。
## 语法
@@ -26,25 +25,34 @@ ATANH(<x>)
参数`x`的反双曲正切值。
+## 特殊情况处理
+
+- 当 `x` 等于 0 时,返回 0
+- 当 `x` 等于 1 或 -1 时,返回 `NULL`
+- 当 `x` 超出 (-1, 1) 范围时,返回 `NULL`
+- 当 `x` 为 NaN 时,返回 NaN
+- 当 `x` 为正无穷大或负无穷大时,返回 `NULL`
+- 当 `x` 为 NULL 时,返回 NULL
+
## 示例
```sql
-select atanh(1.0);
+select atanh(0.0);
```
-```sql
+```text
+------------+
-| atanh(1.0) |
+| atanh(0.0) |
+------------+
-| NULL |
+| 0 |
+------------+
```
```sql
-select atanh(1.0);
+select atanh(-1.0);
```
-```sql
+```text
+-------------+
| atanh(-1.0) |
+-------------+
@@ -56,22 +64,46 @@ select atanh(1.0);
select atanh(1.0);
```
-```sql
+```text
+------------+
-| atanh(0.0) |
+| atanh(1.0) |
+------------+
-| 0 |
+| NULL |
+------------+
```
```sql
-select atanh(1.0);
+select atanh(0.5);
```
-```sql
+```text
+--------------------+
| atanh(0.5) |
+--------------------+
| 0.5493061443340548 |
+--------------------+
```
+
+```sql
+select atanh(cast('nan' as double));
+```
+
+```text
++---------------------------+
+| atanh(cast('nan' AS DOUBLE)) |
++---------------------------+
+| NaN |
++---------------------------+
+```
+
+```sql
+select atanh(cast('inf' as double));
+```
+
+```text
++---------------------------+
+| atanh(cast('inf' AS DOUBLE)) |
++---------------------------+
+| NULL |
++---------------------------+
+```
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/numeric-functions/sqrt.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/numeric-functions/sqrt.md
index 6dc6909c63a..298517d85d6 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/numeric-functions/sqrt.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/numeric-functions/sqrt.md
@@ -9,31 +9,38 @@
返回一个值的平方根,要求输入值大于或等于 0。
-## 别名
-
-- NVL
-
## 语法
```sql
-SQRT(<a>)
+SQRT(<x>)
```
## 参数
-| 参数 | 说明 |
+| 参数 | 描述 |
| -- | -- |
-| `<a>` | 需要被计算平方根的值 |
+| `<x>` | 需要被计算平方根的值 |
## 返回值
-参数 `a` 的平方根
+参数 `x` 的平方根
+
+## 特殊情况处理
+
+- 当 `x` 等于 0 时,返回 0
+- 当 `x` 等于 -0 时,返回 -0
+- 当 `x` 小于 0 时,返回 `NULL`
+- 当 `x` 为 NaN 时,返回 NaN
+- 当 `x` 为正无穷大时,返回 Infinity
+- 当 `x` 为负无穷大时,返回 `NULL`
+- 当 `x` 为 NULL 时,返回 NULL
## 示例
```sql
-select sqrt(9),sqrt(2)
+select sqrt(9), sqrt(2);
```
+
```text
+-------------------------+-------------------------+
| sqrt(cast(9 as DOUBLE)) | sqrt(cast(2 as DOUBLE)) |
@@ -41,3 +48,87 @@ select sqrt(9),sqrt(2)
| 3.0 | 1.4142135623730951 |
+-------------------------+-------------------------+
```
+
+```sql
+select sqrt(1.0);
+```
+
+```text
++------------+
+| sqrt(1.0) |
++------------+
+| 1 |
++------------+
+```
+
+```sql
+select sqrt(0.0);
+```
+
+```text
++------------+
+| sqrt(0.0) |
++------------+
+| 0 |
++------------+
+```
+
+```sql
+select sqrt(-0.0);
+```
+
+```text
++-------------+
+| sqrt(-0.0) |
++-------------+
+| -0 |
++-------------+
+```
+
+```sql
+select sqrt(-1.0);
+```
+
+```text
++-------------+
+| sqrt(-1.0) |
++-------------+
+| NULL |
++-------------+
+```
+
+```sql
+select sqrt(cast('nan' as double));
+```
+
+```text
++---------------------------+
+| sqrt(cast('nan' AS DOUBLE)) |
++---------------------------+
+| NaN |
++---------------------------+
+```
+
+```sql
+select sqrt(cast('inf' as double));
+```
+
+```text
++---------------------------+
+| sqrt(cast('inf' AS DOUBLE)) |
++---------------------------+
+| Infinity |
++---------------------------+
+```
+
+```sql
+select sqrt(cast('-inf' as double));
+```
+
+```text
++----------------------------+
+| sqrt(cast('-inf' AS DOUBLE)) |
++----------------------------+
+| NULL |
++----------------------------+
+```
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]