List:General Discussion« Previous MessageNext Message »
From:Michael Widenius Date:October 5 1999 4:28pm
Subject:i just got another little bug
View as plain text  
>>>>> "Balint" == Balint TOTH <bali@stripped> writes:

Balint> Hi All!
Balint> I just hit another little bug in 3.23.4 (with 22.25 too):

Balint> round(0*-1) returns -0

Balint> select round(0*-1)  -> -0
Balint> select round(-0)    -> 0
Balint> select 0*-1  -> 0

Balint> IMHO it all should be 0 without the sign

Balint> ---BaLi

Hi!

The problem is that modern machines supports negative 0 (-0). In the above case
MySQL executes the multiplication in double precision and uses the
sprintf() command to convert the value from double to a string as follows:

sprintf(buff,"%.*f",(int) decimals,num);

This returns -0 when num is -0, which is allowed in C (I really don't
know what SQL should do in this case, but I assume that SQL is also
allowed to return -0)

Regards,
Monty
Thread
i just got another little bugBalint TOTH29 Sep
  • i just got another little bugJani Tolonen2 Oct
  • i just got another little bugMichael Widenius5 Oct
  • Re: i just got another little bugMatthias Fichtner5 Oct
    • Re: i just got another little bugMichael Widenius6 Oct
    • DelphiAndre Natal7 Oct
      • Re: Delphisinisa7 Oct
Re: Delphi(Jairo Souto)8 Oct
Re: Delphi(Jairo Souto)8 Oct