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
da372fb9
Commit
da372fb9
authored
Jun 25, 2016
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ull2dec: exact calculation of the precision
parent
4dcbb775
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
9 deletions
+8
-9
mysql-test/r/bigint.result
mysql-test/r/bigint.result
+2
-2
mysql-test/r/dyncol.result
mysql-test/r/dyncol.result
+5
-5
strings/decimal.c
strings/decimal.c
+1
-2
No files found.
mysql-test/r/bigint.result
View file @
da372fb9
...
...
@@ -385,7 +385,7 @@ def -((9223372036854775808)) 8 20 20 N 32897 0 63
-9223372036854775808
select -(-(9223372036854775808));
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def -(-(9223372036854775808)) 246 2
1
19 N 32897 0 63
def -(-(9223372036854775808)) 246 2
0
19 N 32897 0 63
-(-(9223372036854775808))
9223372036854775808
select --9223372036854775808, ---9223372036854775808, ----9223372036854775808;
...
...
@@ -402,7 +402,7 @@ drop table t1;
create table t1 select -9223372036854775809 bi;
describe t1;
Field Type Null Key Default Extra
bi decimal(
20
,0) NO NULL
bi decimal(
19
,0) NO NULL
drop table t1;
#
# Bug #45360: wrong results
...
...
mysql-test/r/dyncol.result
View file @
da372fb9
...
...
@@ -91,19 +91,19 @@ hex(COLUMN_CREATE(1, NULL AS decimal))
000000
select hex(COLUMN_CREATE(1, 1212 AS decimal));
hex(COLUMN_CREATE(1, 1212 AS decimal))
0001000100040
90080000
4BC
0001000100040
4008
4BC
select hex(COLUMN_CREATE(1, 7 AS decimal));
hex(COLUMN_CREATE(1, 7 AS decimal))
0001000100040
9008000000
7
0001000100040
1008
7
select hex(COLUMN_CREATE(1, 8 AS decimal));
hex(COLUMN_CREATE(1, 8 AS decimal))
0001000100040
9008000000
8
0001000100040
1008
8
select hex(COLUMN_CREATE(1, 127 AS decimal));
hex(COLUMN_CREATE(1, 127 AS decimal))
0001000100040
90080000
07F
0001000100040
3008
07F
select hex(COLUMN_CREATE(1, 128 AS decimal));
hex(COLUMN_CREATE(1, 128 AS decimal))
0001000100040
90080000
080
0001000100040
3008
080
select hex(COLUMN_CREATE(1, 12.12 AS decimal));
hex(COLUMN_CREATE(1, 12.12 AS decimal))
00010001000402028C0C
...
...
strings/decimal.c
View file @
da372fb9
...
...
@@ -1005,8 +1005,7 @@ static int ull2dec(ulonglong from, decimal_t *to)
error
=
E_DEC_OVERFLOW
;
}
to
->
frac
=
0
;
/* intg can't be bigger than number of digits in a ulonglong (20) */
to
->
intg
=
MY_MIN
(
intg1
*
DIG_PER_DEC1
,
20
);
for
(
to
->
intg
=
(
intg1
-
1
)
*
DIG_PER_DEC1
;
from
;
to
->
intg
++
,
from
/=
10
)
{}
for
(
buf
=
to
->
buf
+
intg1
;
intg1
;
intg1
--
)
{
...
...
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