Description:
The High version does not meet expectations when using function round(X,D) to output values with more than four decimal places, Suspected bug introduced by the new version.
Example:
mysql [localhost:8018] {root} ((none)) > select round(1/3,9);
+--------------+
| round(1/3,9) |
+--------------+
| 0.333333333 |
+--------------+
1 row in set (0.00 sec)
mysql [localhost:8018] {root} ((none)) > select 1/3;
+--------+
| 1/3 |
+--------+
| 0.3333 |
+--------+
1 row in set (0.00 sec)
------------------- new version output----------------------------
mysql [localhost:8032] {root} ((none)) > select round(1/3,9);
+--------------+
| round(1/3,9) |
+--------------+
| 0.3333 |
+--------------+
1 row in set (0.00 sec)
mysql [localhost:8032] {root} ((none)) > select round(1.0/3,9);
+--------------------+
| round(1.00000/3,9) |
+--------------------+
| 0.33333 |
+--------------------+
1 row in set (0.00 sec)
mysql [localhost:8032] {root} ((none)) > select 1/3;
+--------+
| 1/3 |
+--------+
| 0.3333 |
+--------+
1 row in set (0.00 sec)
-------------------------------------------------
It is speculated that the version that introduced the problem is as follows:
changed version:https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-22.html
Commit:https://github.com/mysql/mysql-server/commit/0caa1d0dab0ade24abeb2e87bffb7c04e4420789
How to repeat:
At present, only 4 decimal places can be reserved by default. Temporarily use the following temporary solution to avoid.
In the case of using 9 decimal places, add 5 decimal places to the numerator by default.
Example:
mysql [localhost:8032] {root} ((none)) > select round(1.00000/3,9);
+--------------------+
| round(1.00000/3,9) |
+--------------------+
| 0.333333333 |
+--------------------+
1 row in set (0.00 sec)