List:General Discussion« Previous MessageNext Message »
From:Martin Ramsch Date:September 21 1999 4:59am
Subject:Re: BUG.... ?
View as plain text  
On Tue, 1999-09-21 12:06:55 +0800, Oleg N. Krupenko wrote:
>  Two first query BUG:
[...]
> +-------------+
> | round(12.5) |
> +-------------+
> |          12 |
> +-------------+
> +-------------+
> | round(14.5) |
> +-------------+
> |          14 |
> +-------------+
> +-------------+
> | round(13.5) |
> +-------------+
> |          14 |
> +-------------+

I just had a look at the source code of MySQl V3.22.19b, and it's
using the C function 'rint' for rounding, which in turn works
according to IEEE754.  And as far as I know, this standard says that
for values exactly in the middle (as .5 is), rounding always should go
towards the even number (so to avoid a statistical imbalance).

If you want .5 always to be rounded up, you might use
   floor(number+0.5)

Regards,
  Martin
-- 
Martin Ramsch <m.ramsch@stripped> <URL: http://home.pages.de/~ramsch/ >
PGP KeyID=0xE8EF4F75 FiPr=52 44 5E F3 B0 B1 38 26  E4 EC 80 58 7B 31 3A D7
Thread
BUG.... ?Oleg N. Krupenko21 Sep
  • Re: BUG.... ?Martin Ramsch21 Sep