This is an automated email from the ASF dual-hosted git repository. kassiez 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 0a6d40af8e3 [Doc]New floor to fpow (#1942) 0a6d40af8e3 is described below commit 0a6d40af8e36248e7ee0155eab92b453b5c761f2 Author: xiaozhuoyang <98680833+xiaozhuoy...@users.noreply.github.com> AuthorDate: Wed Feb 12 11:32:26 2025 +0800 [Doc]New floor to fpow (#1942) ## Versions - [x] dev - [x] 3.0 - [x] 2.1 - [ ] 2.0 ## Languages - [x] Chinese - [x] English ## Docs Checklist - [ ] Checked by AI - [ ] Test Cases Built --------- Signed-off-by: leozhuo <961937...@qq.com> --- .../scalar-functions/numeric-functions/log10.md | 86 ++++++++++++++-------- .../scalar-functions/numeric-functions/log2.md | 78 +++++++++++++------- .../scalar-functions/numeric-functions/log10.md | 80 +++++++++++++------- .../scalar-functions/numeric-functions/log2.md | 74 +++++++++++++------ .../scalar-functions/numeric-functions/log10.md | 80 +++++++++++++------- .../scalar-functions/numeric-functions/log2.md | 74 +++++++++++++------ .../scalar-functions/numeric-functions/log10.md | 80 +++++++++++++------- .../scalar-functions/numeric-functions/log2.md | 74 +++++++++++++------ .../scalar-functions/numeric-functions/log10.md | 84 +++++++++++++-------- .../scalar-functions/numeric-functions/log2.md | 78 +++++++++++++------- .../scalar-functions/numeric-functions/log10.md | 84 +++++++++++++-------- .../scalar-functions/numeric-functions/log2.md | 78 +++++++++++++------- 12 files changed, 632 insertions(+), 318 deletions(-) diff --git a/docs/sql-manual/sql-functions/scalar-functions/numeric-functions/log10.md b/docs/sql-manual/sql-functions/scalar-functions/numeric-functions/log10.md index c806fe7dd5c..e176d0c3c5a 100644 --- a/docs/sql-manual/sql-functions/scalar-functions/numeric-functions/log10.md +++ b/docs/sql-manual/sql-functions/scalar-functions/numeric-functions/log10.md @@ -22,40 +22,68 @@ specific language governing permissions and limitations under the License. --> -## log10 +## Description -### description -#### Syntax - -`DOUBLE log10(DOUBLE x)` Returns the natural logarithm of `x` to base `10`. -:::tip -Another alias for this function is `dlog10`. -::: +## Alias + +- DLOG10 + +## Syntax + +```sql +LOG10(<x>) +``` + +## Parameters + +| Parameter | Description | +|-----------|------------| +| `<x>` | Antilogarithm should be greater than 0 | + +## Return value + +Returns a floating-point number. + +- If x IS NULL: return `NULL` -### example +## Example +```sql +select log10(1); ``` -mysql> select log10(1); -+------------+ -| log10(1.0) | -+------------+ -| 0 | -+------------+ -mysql> select log10(10); -+-------------+ -| log10(10.0) | -+-------------+ -| 1 | -+-------------+ -mysql> select log10(16); -+--------------------+ -| log10(16.0) | -+--------------------+ -| 1.2041199826559248 | -+--------------------+ + +```text ++--------------------------+ +| log10(cast(1 as DOUBLE)) | ++--------------------------+ +| 0.0 | ++--------------------------+ +``` + +```sql +select log10(10); +``` + +```text ++---------------------------+ +| log10(cast(10 as DOUBLE)) | ++---------------------------+ +| 1.0 | ++---------------------------+ ``` -### keywords - LOG10, DLOG10 +```sql +select log10(16); +``` + +```text ++---------------------------+ +| log10(cast(16 as DOUBLE)) | ++---------------------------+ +| 1.2041199826559248 | ++---------------------------+ +``` + + diff --git a/docs/sql-manual/sql-functions/scalar-functions/numeric-functions/log2.md b/docs/sql-manual/sql-functions/scalar-functions/numeric-functions/log2.md index 8a213c2acb7..73e435b8ed3 100644 --- a/docs/sql-manual/sql-functions/scalar-functions/numeric-functions/log2.md +++ b/docs/sql-manual/sql-functions/scalar-functions/numeric-functions/log2.md @@ -22,36 +22,62 @@ specific language governing permissions and limitations under the License. --> -## log2 +## Description -### description -#### Syntax - -`DOUBLE log2(DOUBLE x)` Returns the natural logarithm of `x` to base `2`. -### example +## Syntax +```sql +LOG2(<x>) ``` -mysql> select log2(1); -+-----------+ -| log2(1.0) | -+-----------+ -| 0 | -+-----------+ -mysql> select log2(2); -+-----------+ -| log2(2.0) | -+-----------+ -| 1 | -+-----------+ -mysql> select log2(10); -+--------------------+ -| log2(10.0) | -+--------------------+ -| 3.3219280948873622 | -+--------------------+ + +## Parameters + +| Parameter | Description | +|-----------|------------| +| `<x>` | Antilogarithm should be greater than 0 | + +## Return value + +Returns a floating-point number. + +- If x IS NULL: return `NULL` + +## Example + +```sql +select log2(1); ``` -### keywords - LOG2 +```text ++-------------------------+ +| log2(cast(1 as DOUBLE)) | ++-------------------------+ +| 0.0 | ++-------------------------+ +``` + +```sql +select log2(2); +``` + +```text ++-------------------------+ +| log2(cast(2 as DOUBLE)) | ++-------------------------+ +| 1.0 | ++-------------------------+ +``` + +```sql +select log2(10); +``` + +```text ++--------------------------+ +| log2(cast(10 as DOUBLE)) | ++--------------------------+ +| 3.3219280948873626 | ++--------------------------+ +``` diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/numeric-functions/log10.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/numeric-functions/log10.md index 430c7b91b26..38eac0ab41b 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/numeric-functions/log10.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/numeric-functions/log10.md @@ -22,40 +22,66 @@ specific language governing permissions and limitations under the License. --> -## log10 - ## 描述 + +返回以`10`为底的`x`的自然对数。 + +## 别名 + +- DLOG10 + ## 语法 -`DOUBLE log10(DOUBLE x)` -返回以`10`为底的`x`的自然对数. +```sql +LOG10(<x>) +``` + +## 参数 + +| 参数 | 说明 | +| -- | -- | +| `<x>` | 真数 必须大于0 | + +## 返回值 -:::tip -该函数的另一个别名为 `dlog10`。 -::: +返回一个浮点数。 + +- 当 x IS NULL:返回 `NULL` ## 举例 +```sql +select log10(1); ``` -mysql> select log10(1); -+------------+ -| log10(1.0) | -+------------+ -| 0 | -+------------+ -mysql> select log10(10); -+-------------+ -| log10(10.0) | -+-------------+ -| 1 | -+-------------+ -mysql> select log10(16); -+--------------------+ -| log10(16.0) | -+--------------------+ -| 1.2041199826559248 | -+--------------------+ + +```text ++--------------------------+ +| log10(cast(1 as DOUBLE)) | ++--------------------------+ +| 0.0 | ++--------------------------+ ``` -### keywords - LOG10, DLOG10 +```sql +select log10(10); +``` + +```text ++---------------------------+ +| log10(cast(10 as DOUBLE)) | ++---------------------------+ +| 1.0 | ++---------------------------+ +``` + +```sql +select log10(16); +``` + +```text ++---------------------------+ +| log10(cast(16 as DOUBLE)) | ++---------------------------+ +| 1.2041199826559248 | ++---------------------------+ +``` diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/numeric-functions/log2.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/numeric-functions/log2.md index bb3deab5c8b..e111c332bad 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/numeric-functions/log2.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/numeric-functions/log2.md @@ -22,36 +22,62 @@ specific language governing permissions and limitations under the License. --> -## log2 - ## 描述 + +返回以`2`为底的`x`的自然对数。 + ## 语法 -`DOUBLE log2(DOUBLE x)` -返回以`2`为底的`x`的自然对数. +```sql +LOG2(<x>) +``` + +## 参数 + +| 参数 | 说明 | +| -- | -- | +| `<x>` | 真数 必须大于0 | + +## 返回值 + +返回一个浮点数。特殊情况: + +- 当x为NULL时,返回 `NULL` ## 举例 +```sql +select log2(1); ``` -mysql> select log2(1); -+-----------+ -| log2(1.0) | -+-----------+ -| 0 | -+-----------+ -mysql> select log2(2); -+-----------+ -| log2(2.0) | -+-----------+ -| 1 | -+-----------+ -mysql> select log2(10); -+--------------------+ -| log2(10.0) | -+--------------------+ -| 3.3219280948873622 | -+--------------------+ + +```text ++-------------------------+ +| log2(cast(1 as DOUBLE)) | ++-------------------------+ +| 0.0 | ++-------------------------+ +``` + +```sql +select log2(2); +``` + +```text ++-------------------------+ +| log2(cast(2 as DOUBLE)) | ++-------------------------+ +| 1.0 | ++-------------------------+ +``` + +```sql +select log2(10); ``` -### keywords - LOG2 +```text ++--------------------------+ +| log2(cast(10 as DOUBLE)) | ++--------------------------+ +| 3.3219280948873626 | ++--------------------------+ +``` diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/numeric-functions/log10.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/numeric-functions/log10.md index 430c7b91b26..38eac0ab41b 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/numeric-functions/log10.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/numeric-functions/log10.md @@ -22,40 +22,66 @@ specific language governing permissions and limitations under the License. --> -## log10 - ## 描述 + +返回以`10`为底的`x`的自然对数。 + +## 别名 + +- DLOG10 + ## 语法 -`DOUBLE log10(DOUBLE x)` -返回以`10`为底的`x`的自然对数. +```sql +LOG10(<x>) +``` + +## 参数 + +| 参数 | 说明 | +| -- | -- | +| `<x>` | 真数 必须大于0 | + +## 返回值 -:::tip -该函数的另一个别名为 `dlog10`。 -::: +返回一个浮点数。 + +- 当 x IS NULL:返回 `NULL` ## 举例 +```sql +select log10(1); ``` -mysql> select log10(1); -+------------+ -| log10(1.0) | -+------------+ -| 0 | -+------------+ -mysql> select log10(10); -+-------------+ -| log10(10.0) | -+-------------+ -| 1 | -+-------------+ -mysql> select log10(16); -+--------------------+ -| log10(16.0) | -+--------------------+ -| 1.2041199826559248 | -+--------------------+ + +```text ++--------------------------+ +| log10(cast(1 as DOUBLE)) | ++--------------------------+ +| 0.0 | ++--------------------------+ ``` -### keywords - LOG10, DLOG10 +```sql +select log10(10); +``` + +```text ++---------------------------+ +| log10(cast(10 as DOUBLE)) | ++---------------------------+ +| 1.0 | ++---------------------------+ +``` + +```sql +select log10(16); +``` + +```text ++---------------------------+ +| log10(cast(16 as DOUBLE)) | ++---------------------------+ +| 1.2041199826559248 | ++---------------------------+ +``` diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/numeric-functions/log2.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/numeric-functions/log2.md index bb3deab5c8b..e111c332bad 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/numeric-functions/log2.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/numeric-functions/log2.md @@ -22,36 +22,62 @@ specific language governing permissions and limitations under the License. --> -## log2 - ## 描述 + +返回以`2`为底的`x`的自然对数。 + ## 语法 -`DOUBLE log2(DOUBLE x)` -返回以`2`为底的`x`的自然对数. +```sql +LOG2(<x>) +``` + +## 参数 + +| 参数 | 说明 | +| -- | -- | +| `<x>` | 真数 必须大于0 | + +## 返回值 + +返回一个浮点数。特殊情况: + +- 当x为NULL时,返回 `NULL` ## 举例 +```sql +select log2(1); ``` -mysql> select log2(1); -+-----------+ -| log2(1.0) | -+-----------+ -| 0 | -+-----------+ -mysql> select log2(2); -+-----------+ -| log2(2.0) | -+-----------+ -| 1 | -+-----------+ -mysql> select log2(10); -+--------------------+ -| log2(10.0) | -+--------------------+ -| 3.3219280948873622 | -+--------------------+ + +```text ++-------------------------+ +| log2(cast(1 as DOUBLE)) | ++-------------------------+ +| 0.0 | ++-------------------------+ +``` + +```sql +select log2(2); +``` + +```text ++-------------------------+ +| log2(cast(2 as DOUBLE)) | ++-------------------------+ +| 1.0 | ++-------------------------+ +``` + +```sql +select log2(10); ``` -### keywords - LOG2 +```text ++--------------------------+ +| log2(cast(10 as DOUBLE)) | ++--------------------------+ +| 3.3219280948873626 | ++--------------------------+ +``` diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/numeric-functions/log10.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/numeric-functions/log10.md index 430c7b91b26..38eac0ab41b 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/numeric-functions/log10.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/numeric-functions/log10.md @@ -22,40 +22,66 @@ specific language governing permissions and limitations under the License. --> -## log10 - ## 描述 + +返回以`10`为底的`x`的自然对数。 + +## 别名 + +- DLOG10 + ## 语法 -`DOUBLE log10(DOUBLE x)` -返回以`10`为底的`x`的自然对数. +```sql +LOG10(<x>) +``` + +## 参数 + +| 参数 | 说明 | +| -- | -- | +| `<x>` | 真数 必须大于0 | + +## 返回值 -:::tip -该函数的另一个别名为 `dlog10`。 -::: +返回一个浮点数。 + +- 当 x IS NULL:返回 `NULL` ## 举例 +```sql +select log10(1); ``` -mysql> select log10(1); -+------------+ -| log10(1.0) | -+------------+ -| 0 | -+------------+ -mysql> select log10(10); -+-------------+ -| log10(10.0) | -+-------------+ -| 1 | -+-------------+ -mysql> select log10(16); -+--------------------+ -| log10(16.0) | -+--------------------+ -| 1.2041199826559248 | -+--------------------+ + +```text ++--------------------------+ +| log10(cast(1 as DOUBLE)) | ++--------------------------+ +| 0.0 | ++--------------------------+ ``` -### keywords - LOG10, DLOG10 +```sql +select log10(10); +``` + +```text ++---------------------------+ +| log10(cast(10 as DOUBLE)) | ++---------------------------+ +| 1.0 | ++---------------------------+ +``` + +```sql +select log10(16); +``` + +```text ++---------------------------+ +| log10(cast(16 as DOUBLE)) | ++---------------------------+ +| 1.2041199826559248 | ++---------------------------+ +``` diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/numeric-functions/log2.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/numeric-functions/log2.md index bb3deab5c8b..6e68b4a4e01 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/numeric-functions/log2.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/numeric-functions/log2.md @@ -22,36 +22,62 @@ specific language governing permissions and limitations under the License. --> -## log2 - ## 描述 + +返回以`2`为底的`x`的自然对数。 + ## 语法 -`DOUBLE log2(DOUBLE x)` -返回以`2`为底的`x`的自然对数. +```sql +LOG2(<x>) +``` + +## 参数 + +| 参数 | 说明 | +| -- | -- | +| `<x>` | 真数 should be greater than 0 | + +## 返回值 + +返回一个浮点数。特殊情况: + +- 当x为NULL时,返回 `NULL` ## 举例 +```sql +select log2(1); ``` -mysql> select log2(1); -+-----------+ -| log2(1.0) | -+-----------+ -| 0 | -+-----------+ -mysql> select log2(2); -+-----------+ -| log2(2.0) | -+-----------+ -| 1 | -+-----------+ -mysql> select log2(10); -+--------------------+ -| log2(10.0) | -+--------------------+ -| 3.3219280948873622 | -+--------------------+ + +```text ++-------------------------+ +| log2(cast(1 as DOUBLE)) | ++-------------------------+ +| 0.0 | ++-------------------------+ +``` + +```sql +select log2(2); +``` + +```text ++-------------------------+ +| log2(cast(2 as DOUBLE)) | ++-------------------------+ +| 1.0 | ++-------------------------+ +``` + +```sql +select log2(10); ``` -### keywords - LOG2 +```text ++--------------------------+ +| log2(cast(10 as DOUBLE)) | ++--------------------------+ +| 3.3219280948873626 | ++--------------------------+ +``` diff --git a/versioned_docs/version-2.1/sql-manual/sql-functions/scalar-functions/numeric-functions/log10.md b/versioned_docs/version-2.1/sql-manual/sql-functions/scalar-functions/numeric-functions/log10.md index c806fe7dd5c..f1f894b7639 100644 --- a/versioned_docs/version-2.1/sql-manual/sql-functions/scalar-functions/numeric-functions/log10.md +++ b/versioned_docs/version-2.1/sql-manual/sql-functions/scalar-functions/numeric-functions/log10.md @@ -22,40 +22,66 @@ specific language governing permissions and limitations under the License. --> -## log10 +## Description -### description -#### Syntax - -`DOUBLE log10(DOUBLE x)` Returns the natural logarithm of `x` to base `10`. -:::tip -Another alias for this function is `dlog10`. -::: +## Alias + +- DLOG10 -### example +## Syntax +```sql +LOG10(<x>) ``` -mysql> select log10(1); -+------------+ -| log10(1.0) | -+------------+ -| 0 | -+------------+ -mysql> select log10(10); -+-------------+ -| log10(10.0) | -+-------------+ -| 1 | -+-------------+ -mysql> select log10(16); -+--------------------+ -| log10(16.0) | -+--------------------+ -| 1.2041199826559248 | -+--------------------+ + +## Parameters + +| Parameter | Description | +|-----------|------------| +| `<x>` | Antilogarithm should be greater than 0 | + +## Return value + +Returns a floating-point number. + +- If x IS NULL: return `NULL` + +## Example + +```sql +select log10(1); +``` + +```text ++--------------------------+ +| log10(cast(1 as DOUBLE)) | ++--------------------------+ +| 0.0 | ++--------------------------+ +``` + +```sql +select log10(10); +``` + +```text ++---------------------------+ +| log10(cast(10 as DOUBLE)) | ++---------------------------+ +| 1.0 | ++---------------------------+ +``` + +```sql +select log10(16); ``` -### keywords - LOG10, DLOG10 +```text ++---------------------------+ +| log10(cast(16 as DOUBLE)) | ++---------------------------+ +| 1.2041199826559248 | ++---------------------------+ +``` \ No newline at end of file diff --git a/versioned_docs/version-2.1/sql-manual/sql-functions/scalar-functions/numeric-functions/log2.md b/versioned_docs/version-2.1/sql-manual/sql-functions/scalar-functions/numeric-functions/log2.md index 8a213c2acb7..73e435b8ed3 100644 --- a/versioned_docs/version-2.1/sql-manual/sql-functions/scalar-functions/numeric-functions/log2.md +++ b/versioned_docs/version-2.1/sql-manual/sql-functions/scalar-functions/numeric-functions/log2.md @@ -22,36 +22,62 @@ specific language governing permissions and limitations under the License. --> -## log2 +## Description -### description -#### Syntax - -`DOUBLE log2(DOUBLE x)` Returns the natural logarithm of `x` to base `2`. -### example +## Syntax +```sql +LOG2(<x>) ``` -mysql> select log2(1); -+-----------+ -| log2(1.0) | -+-----------+ -| 0 | -+-----------+ -mysql> select log2(2); -+-----------+ -| log2(2.0) | -+-----------+ -| 1 | -+-----------+ -mysql> select log2(10); -+--------------------+ -| log2(10.0) | -+--------------------+ -| 3.3219280948873622 | -+--------------------+ + +## Parameters + +| Parameter | Description | +|-----------|------------| +| `<x>` | Antilogarithm should be greater than 0 | + +## Return value + +Returns a floating-point number. + +- If x IS NULL: return `NULL` + +## Example + +```sql +select log2(1); ``` -### keywords - LOG2 +```text ++-------------------------+ +| log2(cast(1 as DOUBLE)) | ++-------------------------+ +| 0.0 | ++-------------------------+ +``` + +```sql +select log2(2); +``` + +```text ++-------------------------+ +| log2(cast(2 as DOUBLE)) | ++-------------------------+ +| 1.0 | ++-------------------------+ +``` + +```sql +select log2(10); +``` + +```text ++--------------------------+ +| log2(cast(10 as DOUBLE)) | ++--------------------------+ +| 3.3219280948873626 | ++--------------------------+ +``` diff --git a/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/numeric-functions/log10.md b/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/numeric-functions/log10.md index c806fe7dd5c..f1f894b7639 100644 --- a/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/numeric-functions/log10.md +++ b/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/numeric-functions/log10.md @@ -22,40 +22,66 @@ specific language governing permissions and limitations under the License. --> -## log10 +## Description -### description -#### Syntax - -`DOUBLE log10(DOUBLE x)` Returns the natural logarithm of `x` to base `10`. -:::tip -Another alias for this function is `dlog10`. -::: +## Alias + +- DLOG10 -### example +## Syntax +```sql +LOG10(<x>) ``` -mysql> select log10(1); -+------------+ -| log10(1.0) | -+------------+ -| 0 | -+------------+ -mysql> select log10(10); -+-------------+ -| log10(10.0) | -+-------------+ -| 1 | -+-------------+ -mysql> select log10(16); -+--------------------+ -| log10(16.0) | -+--------------------+ -| 1.2041199826559248 | -+--------------------+ + +## Parameters + +| Parameter | Description | +|-----------|------------| +| `<x>` | Antilogarithm should be greater than 0 | + +## Return value + +Returns a floating-point number. + +- If x IS NULL: return `NULL` + +## Example + +```sql +select log10(1); +``` + +```text ++--------------------------+ +| log10(cast(1 as DOUBLE)) | ++--------------------------+ +| 0.0 | ++--------------------------+ +``` + +```sql +select log10(10); +``` + +```text ++---------------------------+ +| log10(cast(10 as DOUBLE)) | ++---------------------------+ +| 1.0 | ++---------------------------+ +``` + +```sql +select log10(16); ``` -### keywords - LOG10, DLOG10 +```text ++---------------------------+ +| log10(cast(16 as DOUBLE)) | ++---------------------------+ +| 1.2041199826559248 | ++---------------------------+ +``` \ No newline at end of file diff --git a/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/numeric-functions/log2.md b/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/numeric-functions/log2.md index 8a213c2acb7..73e435b8ed3 100644 --- a/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/numeric-functions/log2.md +++ b/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/numeric-functions/log2.md @@ -22,36 +22,62 @@ specific language governing permissions and limitations under the License. --> -## log2 +## Description -### description -#### Syntax - -`DOUBLE log2(DOUBLE x)` Returns the natural logarithm of `x` to base `2`. -### example +## Syntax +```sql +LOG2(<x>) ``` -mysql> select log2(1); -+-----------+ -| log2(1.0) | -+-----------+ -| 0 | -+-----------+ -mysql> select log2(2); -+-----------+ -| log2(2.0) | -+-----------+ -| 1 | -+-----------+ -mysql> select log2(10); -+--------------------+ -| log2(10.0) | -+--------------------+ -| 3.3219280948873622 | -+--------------------+ + +## Parameters + +| Parameter | Description | +|-----------|------------| +| `<x>` | Antilogarithm should be greater than 0 | + +## Return value + +Returns a floating-point number. + +- If x IS NULL: return `NULL` + +## Example + +```sql +select log2(1); ``` -### keywords - LOG2 +```text ++-------------------------+ +| log2(cast(1 as DOUBLE)) | ++-------------------------+ +| 0.0 | ++-------------------------+ +``` + +```sql +select log2(2); +``` + +```text ++-------------------------+ +| log2(cast(2 as DOUBLE)) | ++-------------------------+ +| 1.0 | ++-------------------------+ +``` + +```sql +select log2(10); +``` + +```text ++--------------------------+ +| log2(cast(10 as DOUBLE)) | ++--------------------------+ +| 3.3219280948873626 | ++--------------------------+ +``` --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org