Hi all, ROUND decimal value is the mis-understood between MySQL internal function and another environment/programming. I found that MySQL-Round is correct within the suitable of itself (you can say it correct in C library or other word it correct in technical term), but it did not useful for the most of business environment especially with financial calculated. If you ever seen on most of business / financial calculator; you would seen the button or switch like down - 5/4 - up in front of the panel. The word 5/4 mean we would like to see the value after calculation adjust up after the decimal we need. That mean round in business need. In my opinion: MySQL need to improve it's ROUND function to according business round NOT follow through C-library or mathematical theory. By the way, I could use ROUND in VB or number_format in PHP to correct this problem.
Sommai At 18:59 3/3/2002 +0100, Roger Baklund wrote: >* Gordon > > This round discussion has nothing to do with floating point > > approximations. > >well... > > > Most round routines are statistically biased on the high side. The MySQL > > round is statistically correct. The more accurate rounding rule is > >As far as I can tell, there is no "MySQL round"... as the behaviour is >different on different platforms. From my original post in this thread: > > > solaris: > > > > mysql> select round(0.05,1),round(0.15,1),round(0.25,1),round(0.35,1); > > +---------------+---------------+---------------+---------------+ > > | round(0.05,1) | round(0.15,1) | round(0.25,1) | round(0.35,1) | > > +---------------+---------------+---------------+---------------+ > > | 0.0 | 0.2 | 0.2 | 0.4 | > > +---------------+---------------+---------------+---------------+ > > 1 row in set (0.00 sec) > > > > Sometimes it rounds up, sometimes it rounds down... > > > > win2k: > > > > mysql> select round(0.05,1),round(0.15,1),round(0.25,1),round(0.35,1); > > +---------------+---------------+---------------+---------------+ > > | round(0.05,1) | round(0.15,1) | round(0.25,1) | round(0.35,1) | > > +---------------+---------------+---------------+---------------+ > > | 0.0 | 0.1 | 0.2 | 0.3 | > > +---------------+---------------+---------------+---------------+ > > 1 row in set (0.00 sec) > >The solaris behaviour seems to match your description of an accurate >rounding. (version 3.23.39-log on solaris and 3.23.30-gamma on win2k) > >The explanation I got was that this depends on the floating point routines >in the C lib, and maybe even the math processor... > >-- >Roger >query > > >--------------------------------------------------------------------- >Before posting, please check: > http://www.mysql.com/manual.php (the manual) > http://lists.mysql.com/ (the list archive) > >To request this thread, e-mail <[EMAIL PROTECTED]> >To unsubscribe, e-mail ><[EMAIL PROTECTED]> >Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php ---------------------------------------------------------- Please be informed that all e-mail which are addressing to thaithanakit.co.th will need to be changed to BTsecurities.com by March 1, 2002 Thank you. :-) ---------------------------------------------------------- --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php