>>>>> "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