Etienne Marcotte wrote: > > maybe you can add a small value to be sure it rounds up. > > select round(9.065+.001,2);
The rounding in 1 on odd and 0 on even is dealing only 5, to make the round more accurate or even, as you mentioned. 6-9 always round in 1 while 1-4 always round in 0. select round(9.065+.001,2) will have problem for '4' and is not a good idea. > > Always add 1 at the digit after the one you want to keep:) > > so 9.065 can also be a variable... > > Etienne > > Shankar Unni wrote: > > > > Attila Soki wrote: > > > > > select round(9.065,2) > > > +----------------+ > > > | round(9.065,2) | > > > +----------------+ > > > | 9,06 | > > > +----------------+ > > > > > > why not 9,07 ?? > > > > Most C compilers today defer things like round() to the floating-point unit > > on the CPU. Most CPUs these days implement IEEE754 as their FP standard, > > and IEEE 754 defines several "rounding modes" that the processor can be set > > to to define the behavior of the round operation. > > > > The default (usually) is "round to nearest even" (which is what the others > > have pointed out). You can also set it to "round towards zero", "round away > > from zero", or "round towards minus infinity". > > > > The application is supposed to know what behavior it prefers, and set the > > default rounding behavior on the FPU by using a specific control > > instruction. The operating systems are supposed to cooperate by saving and > > restoring the process' FP rounding preference when restarting the process > > after an interrupt. > > > > Needless to say, there's a fair amount of confusion on this front, and > > certainly no portable solution, though I believe the latest C standard > > (C99) has some APIs to control this. > > > > The only other choice is to never depend on the FPU rounding, but always > > call a software FP round routine to perform your rounding, if it's that > > important. MySQL hasn't done this (and neither have any of the other DB > > packages I've used recently). > > > > -- > > Shankar. > > > > --------------------------------------------------------------------- > > 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 > > -- > Etienne Marcotte > Specifications Management - Quality Control > Imperial Tobacco Ltd. - Montreal (Qc) Canada > 514.932.6161 x.4001 > > --------------------------------------------------------------------- > 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 --------------------------------------------------------------------- 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