pingcap / pingcap/tidb

round return different result from mysql 8.0

Open
#59,504 0 comments 0 reactions 0 assignees View on GitHub
affects-7.5 affects-8.1 affects-8.5 compatibility-mysql8 component/expression impact/wrong-result report/customer 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)
In TiDB
```
mysql> select round(119.00000000*41.18903250000*0.1402072262804424940061410765110833812375,2);
+---------------------------------------------------------------------------------+
| round(119.00000000*41.18903250000*0.1402072262804424940061410765110833812375,2) |
+---------------------------------------------------------------------------------+
| 687.22 |
+---------------------------------------------------------------------------------+
1 row in set (0.00 sec)

mysql> select round(119.00000000*41.1890325000*0.1402072262804424940061410765110833812375,2);
+--------------------------------------------------------------------------------+
| round(119.00000000*41.1890325000*0.1402072262804424940061410765110833812375,2) |
+--------------------------------------------------------------------------------+
| 687.23 |
+--------------------------------------------------------------------------------+
1 row in set (0.00 sec)
```
In Mysql 8.0.32
```
mysql> select round(119.00000000*41.18903250000*0.1402072262804424940061410765110833812375,2);
+---------------------------------------------------------------------------------+
| round(119.00000000*41.18903250000*0.1402072262804424940061410765110833812375,2) |
+---------------------------------------------------------------------------------+
| 687.23 |
+---------------------------------------------------------------------------------+
1 row in set (0.00 sec)

mysql> select round(119.00000000*41.1890325000*0.1402072262804424940061410765110833812375,2);
+--------------------------------------------------------------------------------+
| round(119.00000000*41.1890325000*0.1402072262804424940061410765110833812375,2) |
+--------------------------------------------------------------------------------+
| 687.23 |
+--------------------------------------------------------------------------------+
1 row in set (0.00 sec)
```
In MySQL 5.7.44
```
mysql> select round(119.00000000*41.18903250000*0.1402072262804424940061410765110833812375,2);
+---------------------------------------------------------------------------------+
| round(119.00000000*41.18903250000*0.1402072262804424940061410765110833812375,2) |
+---------------------------------------------------------------------------------+
| 687.22 |
+---------------------------------------------------------------------------------+
1 row in set (0.00 sec)

mysql> select round(119.00000000*41.1890325000*0.1402072262804424940061410765110833812375,2);
+--------------------------------------------------------------------------------+
| round(119.00000000*41.1890325000*0.1402072262804424940061410765110833812375,2) |
+--------------------------------------------------------------------------------+
| 687.23 |
+--------------------------------------------------------------------------------+
1 row in set (0.00 sec)
```

TiDB's behavior is the same as mysql 5.7, but both mysql 5.7 and TiDB got different result from mysql 8.0

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

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

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

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.