List:MySQL ODBC« Previous MessageNext Message »
From:Dag Sondre Hansen Date:March 11 1999 4:42pm
Subject:Error in MySQL "round" function.
View as plain text  
This one made me scratch my head for quite some time - turned out to be
a bug in the round()-function. It occurs only when there is only one
decimal to be "removed" by round(), and that decimal is 5. In this case
the function returns 0 when the correct answer is 1.

mysql> select round(0.5, 0 ) ;
+------------------+
| round(0.5, 0 )   |
+------------------+
|                0 | <====
+------------------+
1 row in set (0.00 sec)

"select round(0.05, 1 )" and "select round(0.005, 2 )" etc. produces the
same result.


dagS






Thread
Error in MySQL "round" function.Dag Sondre Hansen11 Mar
  • Re: Error in MySQL "round" function.h.kapper11 Mar