Oh, wait. The ever-helpful manual comes through again:
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
There are many references to this "bug" in the MySQL Bug Tracker. All of them reinforce that this is not a bug but rather a variance in C library implementation.
http://bugs.mysql.com/search.php?search_for=round&status=All&severity=all&limit=10&order_by=&cmd=display&direction=ASC&bug_type=Any&assign=&php_os=&phpver=&bug_age=0
Cheers,
--V
Edgar Meij wrote:
Hmmm, peculiar... Tried it on 4.1.6-gamma-nt and works fine:
SELECT ROUND(3.575, 2); = 3,57 SELECT ROUND(3.565, 2); = 3.56
The round() function probably cuts off the last bit...
More info: http://lists.mysql.com/myodbc/8
Regards,
Edgar
-----Oorspronkelijk bericht-----
Van: Tom Butterworth [mailto:[EMAIL PROTECTED] Verzonden: maandag 25 oktober 2004 19:35
Aan: [EMAIL PROTECTED]
Onderwerp: rounding problem
Hi
I seem to be having problems returning the expected results when using the mysql ROUND() function.
Rounding 3.565 to 2 decimal places i would expect to return 3.57 however using
SELECT ROUND(3.565, 2);
it returns 3.56. While using
SELECT ROUND(3.575, 2);
works as expected returning 3.58.
I am using mysql version 3.23.54. Any help much appreciated.
Cheers
Buttie
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]