Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
d2e80802
Commit
d2e80802
authored
Oct 07, 2014
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixes for decimal type
parent
7989c62b
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
1 deletion
+20
-1
mysql-test/r/type_newdecimal.result
mysql-test/r/type_newdecimal.result
+6
-0
mysql-test/t/type_newdecimal.test
mysql-test/t/type_newdecimal.test
+9
-0
strings/decimal.c
strings/decimal.c
+5
-1
No files found.
mysql-test/r/type_newdecimal.result
View file @
d2e80802
...
...
@@ -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
mysql-test/t/type_newdecimal.test
View file @
d2e80802
...
...
@@ -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
;
strings/decimal.c
View file @
d2e80802
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment