mirror of
https://github.com/MariaDB/server.git
synced 2025-12-24 11:21:21 +03:00
Bug #27984 Long Decimal Maths produces truncated results.
decimal_round failed to perform a correct rounding of a decimal number if its first nine digits were '9'. It just sets those digits to 0.
This commit is contained in:
@@ -1517,9 +1517,10 @@ decimal_round(decimal_t *from, decimal_t *to, int scale,
|
||||
dec1 *p0= buf0+intg0+max(frac1, frac0);
|
||||
dec1 *p1= buf1+intg1+max(frac1, frac0);
|
||||
|
||||
to->buf[0]= 0;
|
||||
while (buf0 < p0)
|
||||
*(--p1) = *(--p0);
|
||||
if (unlikely(intg1 > intg0))
|
||||
to->buf[0]= 0;
|
||||
|
||||
intg0= intg1;
|
||||
buf0=to->buf;
|
||||
|
||||
Reference in New Issue
Block a user