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
ed77f02a
Commit
ed77f02a
authored
Nov 17, 2008
by
Alexey Botchkov
Browse files
Options
Browse Files
Download
Plain Diff
merging
parents
9be8ab54
88a88636
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
2 deletions
+29
-2
mysql-test/r/type_newdecimal.result
mysql-test/r/type_newdecimal.result
+15
-0
mysql-test/t/type_newdecimal.test
mysql-test/t/type_newdecimal.test
+10
-0
sql/item_func.cc
sql/item_func.cc
+4
-2
No files found.
mysql-test/r/type_newdecimal.result
View file @
ed77f02a
...
@@ -1534,6 +1534,21 @@ select (1.20396873 * 0.89550000 * 0.68000000 * 1.08721696 * 0.99500000 *
...
@@ -1534,6 +1534,21 @@ select (1.20396873 * 0.89550000 * 0.68000000 * 1.08721696 * 0.99500000 *
(1.20396873 * 0.89550000 * 0.68000000 * 1.08721696 * 0.99500000 *
(1.20396873 * 0.89550000 * 0.68000000 * 1.08721696 * 0.99500000 *
1.01500000 * 1.01500000 * 0.99500000)
1.01500000 * 1.01500000 * 0.99500000)
0.812988073953673124592306939480
0.812988073953673124592306939480
create table t1 as select 5.05 / 0.014;
Warnings:
Note 1265 Data truncated for column '5.05 / 0.014' at row 1
show warnings;
Level Code Message
Note 1265 Data truncated for column '5.05 / 0.014' at row 1
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`5.05 / 0.014` decimal(10,6) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select * from t1;
5.05 / 0.014
360.714286
DROP TABLE t1;
End of 5.0 tests
End of 5.0 tests
select cast(143.481 as decimal(4,1));
select cast(143.481 as decimal(4,1));
cast(143.481 as decimal(4,1))
cast(143.481 as decimal(4,1))
...
...
mysql-test/t/type_newdecimal.test
View file @
ed77f02a
...
@@ -1235,6 +1235,16 @@ DROP TABLE t1;
...
@@ -1235,6 +1235,16 @@ DROP TABLE t1;
select
(
1.20396873
*
0.89550000
*
0.68000000
*
1.08721696
*
0.99500000
*
select
(
1.20396873
*
0.89550000
*
0.68000000
*
1.08721696
*
0.99500000
*
1.01500000
*
1.01500000
*
0.99500000
);
1.01500000
*
1.01500000
*
0.99500000
);
#
# Bug #31616 div_precision_increment description looks wrong
#
create
table
t1
as
select
5.05
/
0.014
;
show
warnings
;
show
create
table
t1
;
select
*
from
t1
;
DROP
TABLE
t1
;
--
echo
End
of
5.0
tests
--
echo
End
of
5.0
tests
#
#
...
...
sql/item_func.cc
View file @
ed77f02a
...
@@ -1301,8 +1301,10 @@ my_decimal *Item_func_div::decimal_op(my_decimal *decimal_value)
...
@@ -1301,8 +1301,10 @@ my_decimal *Item_func_div::decimal_op(my_decimal *decimal_value)
void
Item_func_div
::
result_precision
()
void
Item_func_div
::
result_precision
()
{
{
uint
arg_prec
=
args
[
0
]
->
decimal_precision
()
+
prec_increment
;
uint
precision
=
min
(
args
[
0
]
->
decimal_precision
()
+
uint
precision
=
min
(
arg_prec
,
DECIMAL_MAX_PRECISION
);
args
[
1
]
->
decimals
+
prec_increment
,
DECIMAL_MAX_PRECISION
);
/* Integer operations keep unsigned_flag if one of arguments is unsigned */
/* Integer operations keep unsigned_flag if one of arguments is unsigned */
if
(
result_type
()
==
INT_RESULT
)
if
(
result_type
()
==
INT_RESULT
)
unsigned_flag
=
args
[
0
]
->
unsigned_flag
|
args
[
1
]
->
unsigned_flag
;
unsigned_flag
=
args
[
0
]
->
unsigned_flag
|
args
[
1
]
->
unsigned_flag
;
...
...
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