mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Merge mhansson@bk-internal:/home/bk/mysql-5.1-opt
into linux-st28.site:/home/martin/mysql/src/bug33143/my51-bug33143-pushee sql/item_func.cc: Auto merged mysql-test/r/type_decimal.result: Bug#33143: Manual merge mysql-test/t/type_decimal.test: Bug#33143: Manual merge
This commit is contained in:
@ -1601,9 +1601,21 @@ decimal_round(decimal_t *from, decimal_t *to, int scale,
|
||||
x+=10;
|
||||
*buf1=powers10[pos]*(x-y);
|
||||
}
|
||||
if (frac0 < 0)
|
||||
/*
|
||||
In case we're rounding e.g. 1.5e9 to 2.0e9, the decimal_digit_t's inside
|
||||
the buffer are as follows.
|
||||
|
||||
Before <1, 5e8>
|
||||
After <2, 5e8>
|
||||
|
||||
Hence we need to set the 2nd field to 0.
|
||||
The same holds if we round 1.5e-9 to 2e-9.
|
||||
*/
|
||||
if (frac0 < frac1)
|
||||
{
|
||||
dec1 *end=to->buf+intg0, *buf=buf1+1;
|
||||
dec1 *buf= to->buf + ((scale == 0 && intg0 == 0) ? 1 : intg0 + frac0);
|
||||
dec1 *end= to->buf + len;
|
||||
|
||||
while (buf < end)
|
||||
*buf++=0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user