Re: Round Function Error
Georg Richter <[email protected]>
| Newsgroups | gmane.comp.db.mysql.bugs |
|---|---|
| Message-ID | <[email protected]> |
Hi, From http://www.mysql.com/doc/en/Mathematical_functions.html: Note that the behaviour of ROUND() when the argument is half way between two integers depends on the C library implementation. Some round to the nearest even number, always up, always down, or always toward zero. If you need one kind of rounding, you should use a well-defined function like TRUNCATE() or FLOOR() instead. Regards Georg > Hi, > > I'm using mysql 4.0.16-standard on Linux. > > I've just noticed this: > > mysql> select round(0.5); > +------------+ > > | round(0.5) | > > +------------+ > > | 0 | > > +------------+ > 1 row in set (0.00 sec) > > -- > > mysql> select round(0.500001); > +-----------------+ > > | round(0.500001) | > > +-----------------+ > > | 1 | > > +-----------------+ > 1 row in set (0.00 sec) > > -- > > Is it not the case that 0.5 should be rounded UP? > > -- > Mark -- MySQL Bugs Mailing List For list archives: http://lists.mysql.com/bugs To unsubscribe: http://lists.mysql.com/[email protected]