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
717d92f6
Commit
717d92f6
authored
Jun 09, 2005
by
holyfoot@hf-ibm.(none)
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for bug #10083 (round doesn't increase scale)
parent
1fdc59ac
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
12 deletions
+15
-12
mysql-test/r/func_math.result
mysql-test/r/func_math.result
+3
-0
mysql-test/t/func_math.test
mysql-test/t/func_math.test
+5
-0
sql/item_func.cc
sql/item_func.cc
+7
-12
No files found.
mysql-test/r/func_math.result
View file @
717d92f6
...
@@ -143,3 +143,6 @@ select format(col2,6) from t1 where col1=7;
...
@@ -143,3 +143,6 @@ select format(col2,6) from t1 where col1=7;
format(col2,6)
format(col2,6)
1,234,567,890,123,456.123450
1,234,567,890,123,456.123450
drop table t1;
drop table t1;
select round(150, 2);
round(150, 2)
150.00
mysql-test/t/func_math.test
View file @
717d92f6
...
@@ -79,3 +79,8 @@ insert into t1 values(7,1234567890123456.12345);
...
@@ -79,3 +79,8 @@ insert into t1 values(7,1234567890123456.12345);
select
format
(
col2
,
6
)
from
t1
where
col1
=
7
;
select
format
(
col2
,
6
)
from
t1
where
col1
=
7
;
drop
table
t1
;
drop
table
t1
;
#
# Bug #10083 (round doesn't increase decimals)
#
select
round
(
150
,
2
);
sql/item_func.cc
View file @
717d92f6
...
@@ -1876,7 +1876,8 @@ void Item_func_round::fix_length_and_dec()
...
@@ -1876,7 +1876,8 @@ void Item_func_round::fix_length_and_dec()
max_length
=
float_length
(
decimals
);
max_length
=
float_length
(
decimals
);
break
;
break
;
case
INT_RESULT
:
case
INT_RESULT
:
if
(
truncate
||
(
args
[
0
]
->
decimal_precision
()
<
DECIMAL_LONGLONG_DIGITS
))
if
((
decimals_to_set
==
0
)
&&
(
truncate
||
(
args
[
0
]
->
decimal_precision
()
<
DECIMAL_LONGLONG_DIGITS
)))
{
{
/* Here we can keep INT_RESULT */
/* Here we can keep INT_RESULT */
hybrid_type
=
INT_RESULT
;
hybrid_type
=
INT_RESULT
;
...
@@ -1890,18 +1891,12 @@ void Item_func_round::fix_length_and_dec()
...
@@ -1890,18 +1891,12 @@ void Item_func_round::fix_length_and_dec()
hybrid_type
=
DECIMAL_RESULT
;
hybrid_type
=
DECIMAL_RESULT
;
int
decimals_delta
=
args
[
0
]
->
decimals
-
decimals_to_set
;
int
decimals_delta
=
args
[
0
]
->
decimals
-
decimals_to_set
;
int
precision
=
args
[
0
]
->
decimal_precision
();
int
precision
=
args
[
0
]
->
decimal_precision
();
if
(
decimals_delta
>
0
)
int
length_increase
=
((
decimals_delta
<=
0
)
||
truncate
)
?
0
:
1
;
{
int
length_increase
=
truncate
?
0
:
1
;
precision
-=
decimals_delta
-
length_increase
;
precision
-=
decimals_delta
-
length_increase
;
decimals
=
decimals_to_set
;
decimals
=
decimals_to_set
;
}
else
/* Decimals to set is bigger that the original scale */
/* we keep original decimals value */
decimals
=
args
[
0
]
->
decimals
;
max_length
=
my_decimal_precision_to_length
(
precision
,
decimals
,
max_length
=
my_decimal_precision_to_length
(
precision
,
decimals
,
unsigned_flag
);
unsigned_flag
);
break
;
break
;
}
}
default:
default:
...
...
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