List:MySQL ODBC« Previous MessageNext Message »
From:h.kapper Date:March 11 1999 5:42pm
Subject:Re: Error in MySQL "round" function.
View as plain text  
Hi Dag,
I'm sorry, but round() doesn't go nuts, but round() works mathematically very
sophisticated!

in fact if you check, you'll find that round (1.5,0) makes up for 2, while round (2.5,0)
makes down to 2.

The mathematical-background for this is that you get statistically better results if you
do always round to odd or even numbers. Normally mathematican's choose even numbers and
that's what you get out of round().

If I'm wrong, please correct me - thank you.

Harald Kapper, Kapper & Partner Communications KEG
Vienna, AUSTRIA            Tel.    +43-1-319 55 00
Fax +43-1-319 55 02        e-mail: info@stripped


On Thu, 11 Mar 1999 17:42:40 +0100, Dag Sondre Hansen <sondre@stripped> wrote to
myodbc@stripped:

>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
>
>
>
>
>
>
>
>---------------------------------------------------------------------
>To request this thread, e-mail myodbc-thread7@stripped
>
>To unsubscribe, e-mail the address in the List-Unsubscribe header.
>For additional commands, e-mail: myodbc-help@stripped

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