fixes for decimal type
This commit is contained in:
parent
7989c62bc0
commit
d2e808025a
@ -1988,3 +1988,9 @@ SELECT d1 * d2 FROM t1;
|
||||
d1 * d2
|
||||
0
|
||||
DROP TABLE t1;
|
||||
select 0.000000000000000000000000000000000000000000000000001 mod 1;
|
||||
0.000000000000000000000000000000000000000000000000001 mod 1
|
||||
0.000000000000000000000000000000
|
||||
select 0.0000000001 mod 1;
|
||||
0.0000000001 mod 1
|
||||
0.0000000001
|
||||
|
@ -1570,3 +1570,12 @@ SELECT d1 * d2 FROM t1;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Test for Bug#18469276: MOD FOR SMALL DECIMALS FAILS
|
||||
#
|
||||
select 0.000000000000000000000000000000000000000000000000001 mod 1;
|
||||
|
||||
#
|
||||
# incorrect result
|
||||
#
|
||||
select 0.0000000001 mod 1;
|
||||
|
@ -127,7 +127,6 @@ typedef longlong dec2;
|
||||
#define DIG_BASE 1000000000
|
||||
#define DIG_MAX (DIG_BASE-1)
|
||||
#define DIG_BASE2 ((dec2)DIG_BASE * (dec2)DIG_BASE)
|
||||
#define ROUND_UP(X) (((X)+DIG_PER_DEC1-1)/DIG_PER_DEC1)
|
||||
static const dec1 powers10[DIG_PER_DEC1+1]={
|
||||
1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000};
|
||||
static const int dig2bytes[DIG_PER_DEC1+1]={0, 1, 1, 2, 2, 3, 3, 4, 4, 4};
|
||||
@ -136,6 +135,11 @@ static const dec1 frac_max[DIG_PER_DEC1-1]={
|
||||
999900000, 999990000, 999999000,
|
||||
999999900, 999999990 };
|
||||
|
||||
static inline int ROUND_UP(int x)
|
||||
{
|
||||
return (x + (x > 0 ? 1 : -1) * (DIG_PER_DEC1 - 1)) / DIG_PER_DEC1;
|
||||
}
|
||||
|
||||
#ifdef HAVE_valgrind
|
||||
#define sanity(d) DBUG_ASSERT((d)->len > 0)
|
||||
#else
|
||||
|
Loading…
x
Reference in New Issue
Block a user