From: h.kapper Date: March 11 1999 5:42pm Subject: Re: Error in MySQL "round" function. List-Archive: http://lists.mysql.com/myodbc/8 Message-Id: <36e9000d.83563307@62.116.5.65> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable 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 =46ax +43-1-319 55 02 e-mail: info@stripped On Thu, 11 Mar 1999 17:42:40 +0100, Dag Sondre Hansen = 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 | <=3D=3D=3D=3D >+------------------+ >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