* DL Neil > After a number of rounds of this conversation/developing a > work-around, have we decided that there is a fault/bug?
As far as I can tell, there are at least two bugs. One bug is already known, it is the rounding error that applies to some platforms, depending on the underlaying C library being used: win2k, 3.23.30-gamma: mysql> select round(1.5); +------------+ | round(1.5) | +------------+ | 1 | +------------+ 1 row in set (0.00 sec) solaris, 3.23.39-log: mysql> select round(1.5); +------------+ | round(1.5) | +------------+ | 2 | +------------+ 1 row in set (0.02 sec) This is... inconvenient. Even if the reason for the bug is the different C library implementations, the result will be mysql applications with errors. IMHO the developers should try to work around this, so that the round() function works the same way on all platforms. The other bug is related to the preparation of the statement. It seems the number of decimals in the output column is decided once before the actual query is performed, and this number is fixed: mysql> select *,round(num1,id) from tab4; +------+----------+----------------+ | id | num1 | round(num1,id) | +------+----------+----------------+ | 1 | 1.2345 | 1.2000 | | 2 | 12.3456 | 12.3500 | | 3 | 100.4235 | 100.4230 | +------+----------+----------------+ 3 rows in set (0.01 sec) The parser tries to decide the number of decimals _before_ the query is executed, but as 'id' does not make any sense at that point, the number of decimals in the num1 parameter (4) is used... then, for each row, the round() function is executed with the correct parameters, and the result is "correct" (if we ignore the rounding error), but is then padded with zeroes, so that the total number of decimals is four. This padding makes the result wrong, as "1.2000" is not the same as "1.2" when we talk about human readable numbers. (The first indicate a higher grade of precision.) > I don't recall any 'official' involvement to date. Me neither. > Has 'riga.riga' submitted a Bug Report to MySQL? I don't know. -- Roger query --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php