Skip to content

Commit

Permalink
[Doc]New floor to fpow (#1942)
Browse files Browse the repository at this point in the history
## 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 <[email protected]>
  • Loading branch information
xiaozhuoyang authored Feb 12, 2025
1 parent b386b2a commit 0a6d40a
Show file tree
Hide file tree
Showing 12 changed files with 632 additions and 318 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
+---------------------------+
```


Original file line number Diff line number Diff line change
Expand Up @@ -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 |
+--------------------------+
```
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
+---------------------------+
```
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
+--------------------------+
```
Loading

0 comments on commit 0a6d40a

Please sign in to comment.