1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

ull2dec: exact calculation of the precision

This commit is contained in:
Sergei Golubchik
2016-06-25 23:02:32 +02:00
parent 4dcbb775ae
commit da372fb9dc
3 changed files with 8 additions and 9 deletions

View File

@ -1005,8 +1005,7 @@ static int ull2dec(ulonglong from, decimal_t *to)
error=E_DEC_OVERFLOW;
}
to->frac=0;
/* intg can't be bigger than number of digits in a ulonglong (20) */
to->intg= MY_MIN(intg1*DIG_PER_DEC1, 20);
for(to->intg= (intg1-1)*DIG_PER_DEC1; from; to->intg++, from/=10) {}
for (buf=to->buf+intg1; intg1; intg1--)
{