Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Doc]New floor to fpow #1942

Merged
merged 6 commits into from
Feb 12, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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
@@ -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
@@ -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
@@ -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