pingcap / pingcap/tidb

The compatibility issue of the PI() function in MySQL and TiDB.

Open
#57,668 2 comments 0 reactions 0 assignees View on GitHub
severity/moderate sig/execution type/bug
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Bug Report

Please answer these questions before submitting your issue. Thanks!

### 1. Minimal reproduce step (Required)

Use function over PI()

### 2. What did you expect to see? (Required)

The same behavior between TiDB and MySQL

### 3. What did you see instead (Required)

```sql
// TiDB
mysql> SELECT TAN(PI()+1);
+--------------------+
| TAN(PI()+1) |
+--------------------+
| 1.5574077246549016 |
+--------------------+
1 row in set (0.04 sec)

mysql> SELECT TAN(PI());
+-------------------------+
| TAN(PI()) |
+-------------------------+
| -1.2246467991473515e-16 |
+-------------------------+
1 row in set (0.03 sec)

mysql> SELECT SIN(PI());
+------------------------+
| SIN(PI()) |
+------------------------+
| 1.2246467991473515e-16 |
+------------------------+
1 row in set (0.04 sec)

// MySQL
mysql> SELECT TAN(PI()+1);
+--------------------+
| TAN(PI()+1) |
+--------------------+
| 1.5574077246549018 |
+--------------------+
1 row in set (0.02 sec)

mysql> SELECT TAN(PI());
+-------------------------+
| TAN(PI()) |
+-------------------------+
| -1.2246467991473532e-16 |
+-------------------------+
1 row in set (0.00 sec)

mysql> SELECT SIN(PI());
+------------------------+
| SIN(PI()) |
+------------------------+
| 1.2246467991473532e-16 |
+------------------------+
1 row in set (0.00 sec)
```

### 4. What is your TiDB version? (Required)

TiDB v8.4.0

MySQL v8.4.1

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.