tidb icon indicating copy to clipboard operation
tidb copied to clipboard

round return different result from mysql 8.0

Open windtalker opened this issue 10 months ago • 0 comments

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)

windtalker avatar Feb 13 '25 05:02 windtalker