diff options
-rw-r--r-- | mysql-test/r/type_newdecimal.result | 3 | ||||
-rw-r--r-- | mysql-test/t/type_newdecimal.test | 2 | ||||
-rw-r--r-- | strings/decimal.c | 2 |
3 files changed, 6 insertions, 1 deletions
diff --git a/mysql-test/r/type_newdecimal.result b/mysql-test/r/type_newdecimal.result index 1730ef152e3..3cd5028f858 100644 --- a/mysql-test/r/type_newdecimal.result +++ b/mysql-test/r/type_newdecimal.result @@ -1994,3 +1994,6 @@ select 0.000000000000000000000000000000000000000000000000001 mod 1; select 0.0000000001 mod 1; 0.0000000001 mod 1 0.0000000001 +select 0.01 mod 1; +0.01 mod 1 +0.01 diff --git a/mysql-test/t/type_newdecimal.test b/mysql-test/t/type_newdecimal.test index 5dcbfa15c2f..bb5a61d84ec 100644 --- a/mysql-test/t/type_newdecimal.test +++ b/mysql-test/t/type_newdecimal.test @@ -1579,3 +1579,5 @@ select 0.000000000000000000000000000000000000000000000000001 mod 1; # incorrect result # select 0.0000000001 mod 1; +select 0.01 mod 1; + diff --git a/strings/decimal.c b/strings/decimal.c index 8d6877a24ec..07ccc537e47 100644 --- a/strings/decimal.c +++ b/strings/decimal.c @@ -137,7 +137,7 @@ static const dec1 frac_max[DIG_PER_DEC1-1]={ static inline int ROUND_UP(int x) { - return (x + (x > 0 ? 1 : -1) * (DIG_PER_DEC1 - 1)) / DIG_PER_DEC1; + return (x + (x > 0 ? DIG_PER_DEC1 - 1 : 0)) / DIG_PER_DEC1; } #ifdef HAVE_valgrind |