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
3ddd2771
Commit
3ddd2771
authored
Jul 07, 2005
by
hf@deer.(none)
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for bug #11708 (real function returns wrongly rounded decimal)
parent
bf7515c3
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
0 deletions
+20
-0
mysql-test/r/type_newdecimal.result
mysql-test/r/type_newdecimal.result
+3
-0
mysql-test/t/type_newdecimal.test
mysql-test/t/type_newdecimal.test
+5
-0
sql/item_func.cc
sql/item_func.cc
+11
-0
sql/item_func.h
sql/item_func.h
+1
-0
No files found.
mysql-test/r/type_newdecimal.result
View file @
3ddd2771
...
...
@@ -937,3 +937,6 @@ drop table t1;
select cast('1.00000001335143196001808973960578441619873046875E-10' as decimal(30,15));
cast('1.00000001335143196001808973960578441619873046875E-10' as decimal(30,15))
0.000000000100000
select ln(14000) c1, convert(ln(14000),decimal(2,3)) c2, cast(ln(14000) as decimal(2,3)) c3;
c1 c2 c3
9.5468126085974 9.547 9.547
mysql-test/t/type_newdecimal.test
View file @
3ddd2771
...
...
@@ -978,3 +978,8 @@ drop table t1;
# Bug #10891 (converting to decimal crashes server)
#
select
cast
(
'1.00000001335143196001808973960578441619873046875E-10'
as
decimal
(
30
,
15
));
#
# Bug #11708 (conversion to decimal fails in decimal part)
#
select
ln
(
14000
)
c1
,
convert
(
ln
(
14000
),
decimal
(
2
,
3
))
c2
,
cast
(
ln
(
14000
)
as
decimal
(
2
,
3
))
c3
;
sql/item_func.cc
View file @
3ddd2771
...
...
@@ -566,6 +566,17 @@ String *Item_real_func::val_str(String *str)
}
my_decimal
*
Item_real_func
::
val_decimal
(
my_decimal
*
decimal_value
)
{
DBUG_ASSERT
(
fixed
);
double
nr
=
val_real
();
if
(
null_value
)
return
0
;
/* purecov: inspected */
double2my_decimal
(
E_DEC_FATAL_ERROR
,
nr
,
decimal_value
);
return
decimal_value
;
}
void
Item_func
::
fix_num_length_and_dec
()
{
decimals
=
0
;
...
...
sql/item_func.h
View file @
3ddd2771
...
...
@@ -187,6 +187,7 @@ public:
Item_real_func
(
Item
*
a
,
Item
*
b
)
:
Item_func
(
a
,
b
)
{}
Item_real_func
(
List
<
Item
>
&
list
)
:
Item_func
(
list
)
{}
String
*
val_str
(
String
*
str
);
my_decimal
*
val_decimal
(
my_decimal
*
decimal_value
);
longlong
val_int
()
{
DBUG_ASSERT
(
fixed
==
1
);
return
(
longlong
)
val_real
();
}
enum
Item_result
result_type
()
const
{
return
REAL_RESULT
;
}
...
...
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