diff options
Diffstat (limited to 'strings')
-rw-r--r-- | strings/decimal.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/strings/decimal.c b/strings/decimal.c index 787d00dcb46..4a487f3c9b0 100644 --- a/strings/decimal.c +++ b/strings/decimal.c @@ -1546,6 +1546,14 @@ decimal_round(decimal_t *from, decimal_t *to, int scale, *buf1=1; to->intg++; } + /* Here we check 999.9 -> 1000 case when we need to increase intg */ + else + { + int first_dig= to->intg % DIG_PER_DEC1; + /* first_dig==0 should be handled above in the 'if' */ + if (first_dig && (*buf1 >= powers10[first_dig])) + to->intg++; + } } else { |