tidb
tidb copied to clipboard
round return different result from mysql 8.0
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