diff options
author | unknown <serg@serg.mylan> | 2004-11-02 09:45:03 +0100 |
---|---|---|
committer | unknown <serg@serg.mylan> | 2004-11-02 09:45:03 +0100 |
commit | 7e788724af68879137c37f7fd371f50f09064e57 (patch) | |
tree | 9a7283382e2e30df1084ed8c51dfe78537638c8c /strings | |
parent | 076420c8d5ebfcdb25ca9685f1635637a63c501c (diff) | |
download | mariadb-git-7e788724af68879137c37f7fd371f50f09064e57.tar.gz |
ROUND_UP(negative_number) doesn't work
Diffstat (limited to 'strings')
-rw-r--r-- | strings/decimal.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/strings/decimal.c b/strings/decimal.c index 10257e22208..67931ef8a05 100644 --- a/strings/decimal.c +++ b/strings/decimal.c @@ -818,7 +818,8 @@ int decimal_bin_size(int precision, int scale) int decimal_round(decimal *from, decimal *to, int scale, decimal_round_mode mode) { - int frac0=ROUND_UP(scale), frac1=ROUND_UP(from->frac), + int frac0=scale>0 ? ROUND_UP(scale) : scale/DIG_PER_DEC1, + frac1=ROUND_UP(from->frac), intg0=ROUND_UP(from->intg), error=E_DEC_OK, len=to->len; dec1 *buf0=from->buf, *buf1=to->buf, x, y, carry=0; @@ -1976,6 +1977,7 @@ main() test_ro("5678.123451",5,TRUNCATE); test_ro("5678.123451",6,TRUNCATE); test_ro("-5678.123451",-4,TRUNCATE); + test_ro("99999999999999999999999999999999999999",-31,TRUNCATE); printf("==== decimal_mod ====\n"); test_md("234","10"); |