round return different result from mysql 8.0
- 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
Assessment
This issue has not been assessed yet.