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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
cc007a5c
Commit
cc007a5c
authored
Jun 09, 2005
by
hf@deer.(none)
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for bug #8482 (Incorrect rounding)
parent
8feae4d4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
0 deletions
+23
-0
mysql-test/r/type_newdecimal.result
mysql-test/r/type_newdecimal.result
+8
-0
mysql-test/t/type_newdecimal.test
mysql-test/t/type_newdecimal.test
+7
-0
strings/decimal.c
strings/decimal.c
+8
-0
No files found.
mysql-test/r/type_newdecimal.result
View file @
cc007a5c
...
@@ -896,6 +896,14 @@ create table t1( d1 decimal(18) unsigned, d2 decimal(20) unsigned, d3 decimal (2
...
@@ -896,6 +896,14 @@ create table t1( d1 decimal(18) unsigned, d2 decimal(20) unsigned, d3 decimal (2
insert into t1 values(1,-1,-1);
insert into t1 values(1,-1,-1);
ERROR 22003: Out of range value adjusted for column 'd2' at row 1
ERROR 22003: Out of range value adjusted for column 'd2' at row 1
drop table t1;
drop table t1;
create table t1 (col1 decimal(5,2), col2 numeric(5,2));
insert into t1 values (999.999,999.999);
ERROR 22003: Out of range value adjusted for column 'col1' at row 1
insert into t1 values (-999.999,-999.999);
ERROR 22003: Out of range value adjusted for column 'col1' at row 1
select * from t1;
col1 col2
drop table t1;
set sql_mode='';
set sql_mode='';
set @sav_dpi= @@div_precision_increment;
set @sav_dpi= @@div_precision_increment;
set @@div_precision_increment=15;
set @@div_precision_increment=15;
...
...
mysql-test/t/type_newdecimal.test
View file @
cc007a5c
...
@@ -934,6 +934,13 @@ create table t1( d1 decimal(18) unsigned, d2 decimal(20) unsigned, d3 decimal (2
...
@@ -934,6 +934,13 @@ create table t1( d1 decimal(18) unsigned, d2 decimal(20) unsigned, d3 decimal (2
--
error
1264
--
error
1264
insert
into
t1
values
(
1
,
-
1
,
-
1
);
insert
into
t1
values
(
1
,
-
1
,
-
1
);
drop
table
t1
;
drop
table
t1
;
create
table
t1
(
col1
decimal
(
5
,
2
),
col2
numeric
(
5
,
2
));
--
error
1264
insert
into
t1
values
(
999.999
,
999.999
);
--
error
1264
insert
into
t1
values
(
-
999.999
,
-
999.999
);
select
*
from
t1
;
drop
table
t1
;
set
sql_mode
=
''
;
set
sql_mode
=
''
;
#
#
...
...
strings/decimal.c
View file @
cc007a5c
...
@@ -1546,6 +1546,14 @@ decimal_round(decimal_t *from, decimal_t *to, int scale,
...
@@ -1546,6 +1546,14 @@ decimal_round(decimal_t *from, decimal_t *to, int scale,
*
buf1
=
1
;
*
buf1
=
1
;
to
->
intg
++
;
to
->
intg
++
;
}
}
/* Here we check 999.9 -> 1000 case when we need to increase intg */
else
{
int
first_dig
=
to
->
intg
%
DIG_PER_DEC1
;
/* first_dig==0 should be handled above in the 'if' */
if
(
first_dig
&&
(
*
buf1
>=
powers10
[
first_dig
]))
to
->
intg
++
;
}
}
}
else
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