List:General Discussion« Previous MessageNext Message »
From:Michael Widenius Date:September 28 1999 11:15pm
Subject:Re: Weird ROUND behaviour
View as plain text  
>>>>> "Steve" == Steve Ruby <stever@stripped> writes:

>> > >Why doesn't the ROUND function work like it says in the manual? The
> manual
>> > >says:
>> > >

>> The expected behaviour for ROUND(), as I see it, would be to round
>> toward the nearest integer number:
>> ROUND(-1.9) --> -2
>> ROUND(-1.1) --> -1
>> ROUND(0.1)  -->  1     <--------  I assume you mean 0 here ?
>> ROUND(0.9)  -->  2

Steve> this is somewhat disturbing. I imagine that TCX will consdier it a bug
Steve> though, they
Steve> have made efforts to make the functionality of the win and UNIX version
Steve> as close
Steve> as possible.  The way the unix round works seems reasonable to me, but
Steve> the win
Steve> one is kind of disturbing it always goes for the next higher int

Steve> round(0.0000000001) = 1     ouch

Hi!

I just found a bug in our win32 implementation of rint() that causes
round() to not round to the nearest integer.

I will fix this for the next MySQL-Win32 version.

This will solve everything, except the problem with rounding of x.5 ;
This will always be rounded downwards.  (Sorry, but I don't know how
to fix this on easily on Win32)

Regards,
Monty
Thread
Weird ROUND behaviourJuho Tikkala27 Sep
  • Re: Weird ROUND behaviourPaul DuBois27 Sep
    • Re: Weird ROUND behaviourMartin Ramsch28 Sep
      • Re: Weird ROUND behaviourThimble Smith28 Sep
  • Re: Weird ROUND behaviourSteve Ruby28 Sep
    • Re: Weird ROUND behaviourMartin Ramsch28 Sep
    • Re: Weird ROUND behaviourMichael Widenius29 Sep
      • Re: Weird ROUND behaviourBob Kline29 Sep
        • Re: Weird ROUND behaviourTonu Samuel29 Sep
          • Re: Weird ROUND behaviourJames Manning29 Sep
        • Re: Weird ROUND behaviourScott Hess29 Sep
        • Re: Weird ROUND behaviourTonu Samuel30 Sep
        • Re: Weird ROUND behaviourScott Hess30 Sep
        • Re: Weird ROUND behaviourTonu Samuel30 Sep