Bug #74827 unexpected value returned by ROUND()
Submitted: 13 Nov 2014 3:08 Modified: 13 Nov 2014 3:16
Reporter: zhai weixiang (OCA) Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.7.5 OS:Any
Assigned to: CPU Architecture:Any

[13 Nov 2014 3:08] zhai weixiang
Description:
root@sb1 11:05:51>select (25e-1),round(25e-1),round(2.5);
+-------+--------------+------------+
| 25e-1 | round(25e-1) | round(2.5) |
+-------+--------------+------------+
|   2.5 |            2 |          3 |
+-------+--------------+------------+
1 row in set (1.70 sec)

How to repeat:
Desc above

Suggested fix:
I am not familiar with the code here. Simply trace the code, seems different code path  is called.

for round(25e-1), Item_func_round::real_op is called
for round(2.5), Item_func_round::decimal_op is called
[13 Nov 2014 3:16] zhai weixiang
Seems expected behavior, http://dev.mysql.com/doc/refman/5.6/en/precision-math-rounding.html

change to "NOT A BUG"