diff options
author | hf@deer.(none) <> | 2005-07-12 14:17:59 +0500 |
---|---|---|
committer | hf@deer.(none) <> | 2005-07-12 14:17:59 +0500 |
commit | ba559d651ebf36afe4cd631691b3b5f4cb0559eb (patch) | |
tree | 8c809e2e67eaf131691de4db9c69077216ff7111 /strings/decimal.c | |
parent | 6955f0e76b2528fdb200da8e0a3278e1a5540cc7 (diff) | |
download | mariadb-git-ba559d651ebf36afe4cd631691b3b5f4cb0559eb.tar.gz |
Fix for bug #11557 (Error during rounding of the DEFAULT values)
Diffstat (limited to 'strings/decimal.c')
-rw-r--r-- | strings/decimal.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/strings/decimal.c b/strings/decimal.c index 76e62080ba0..1d75502f0da 100644 --- a/strings/decimal.c +++ b/strings/decimal.c @@ -1443,6 +1443,7 @@ decimal_round(decimal_t *from, decimal_t *to, int scale, intg1=ROUND_UP(from->intg + (((intg0 + frac0)>0) && (from->buf[0] == DIG_MAX))); dec1 *buf0=from->buf, *buf1=to->buf, x, y, carry=0; + int first_dig; sanity(to); @@ -1578,14 +1579,6 @@ decimal_round(decimal_t *from, decimal_t *to, int scale, *buf1=1; to->intg++; } - else - { - /* Here we check 999.9 -> 1000 case when we need to increase intg */ - 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 { @@ -1606,6 +1599,12 @@ decimal_round(decimal_t *from, decimal_t *to, int scale, } } } + + /* Here we check 999.9 -> 1000 case when we need to increase intg */ + first_dig= to->intg % DIG_PER_DEC1; + if (first_dig && (*buf1 >= powers10[first_dig])) + to->intg++; + if (scale<0) scale=0; |