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"

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.051 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.