Bug #4499 Wrong round() results
Submitted: 10 Jul 2004 12:30 Modified: 13 Jul 2004 10:35
Reporter: Karol T. Gajowniczek Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:3.23 and 4.0.18 and 4.0.20 OS:Linux (Debian GNU/Linux)
Assigned to: CPU Architecture:Any

[10 Jul 2004 12:30] Karol T. Gajowniczek
Description:
mysql> SELECT round(1.25,1), round(1.35,1); 
+---------------+---------------+ 
| round(1.25,1) | round(1.35,1) | 
+---------------+---------------+ 
|           1.2 |           1.4 | 
+---------------+---------------+ 
 

How to repeat:
 

Suggested fix:
Make them all round up as in maths.
[13 Jul 2004 10:35] Hartmut Holzgraefe
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.mysql.com/documentation/ and the instructions on
how to report a bug at http://bugs.mysql.com/how-to-report.php

Additional info:

From the Manual documentation on ROUND():

"Note that the behavior of ROUND() when the argument is halfway between two integers depends on the C library implementation. Different implementations round to the nearest even number, always up, always down, or always toward zero. If you need one kind of rounding, you should use a well-defined function such as TRUNCATE() or FLOOR() instead." 

http://dev.mysql.com/doc/mysql/en/Mathematical_functions.html#IDX1363