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
50a8dbc8
Commit
50a8dbc8
authored
Oct 25, 2005
by
hf@deer.(none)
Browse files
Options
Browse Files
Download
Plain Diff
Merge deer.(none):/home/hf/work/mysql-5.0.13820
into deer.(none):/home/hf/work/mysql-5.0.12267
parents
8cd02414
15fbd07a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
71 additions
and
6 deletions
+71
-6
mysql-test/r/func_math.result
mysql-test/r/func_math.result
+27
-0
mysql-test/t/func_math.test
mysql-test/t/func_math.test
+12
-0
sql/item_func.cc
sql/item_func.cc
+32
-6
No files found.
mysql-test/r/func_math.result
View file @
50a8dbc8
...
...
@@ -170,3 +170,30 @@ insert into t1 values (1);
select rand(i) from t1;
ERROR HY000: Incorrect arguments to RAND
drop table t1;
set sql_mode='traditional';
select ln(-1);
ln(-1)
NULL
Warnings:
Error 1365 Division by 0
select log10(-1);
log10(-1)
NULL
Warnings:
Error 1365 Division by 0
select log2(-1);
log2(-1)
NULL
Warnings:
Error 1365 Division by 0
select log(2,-1);
log(2,-1)
NULL
Warnings:
Error 1365 Division by 0
select log(-2,1);
log(-2,1)
NULL
Warnings:
Error 1365 Division by 0
set sql_mode='';
mysql-test/t/func_math.test
View file @
50a8dbc8
...
...
@@ -117,3 +117,15 @@ select rand(i) from t1;
drop
table
t1
;
# End of 4.1 tests
#
# Bug #13820 (No warning on log(negative)
#
set
sql_mode
=
'traditional'
;
select
ln
(
-
1
);
select
log10
(
-
1
);
select
log2
(
-
1
);
select
log
(
2
,
-
1
);
select
log
(
-
2
,
1
);
set
sql_mode
=
''
;
sql/item_func.cc
View file @
50a8dbc8
...
...
@@ -1386,8 +1386,13 @@ double Item_func_ln::val_real()
{
DBUG_ASSERT
(
fixed
==
1
);
double
value
=
args
[
0
]
->
val_real
();
if
((
null_value
=
(
args
[
0
]
->
null_value
||
value
<=
0.0
)))
if
((
null_value
=
args
[
0
]
->
null_value
))
return
0.0
;
if
((
null_value
=
value
<=
0.0
))
{
signal_divide_by_null
();
return
0.0
;
}
return
log
(
value
);
}
...
...
@@ -1400,13 +1405,23 @@ double Item_func_log::val_real()
{
DBUG_ASSERT
(
fixed
==
1
);
double
value
=
args
[
0
]
->
val_real
();
if
((
null_value
=
(
args
[
0
]
->
null_value
||
value
<=
0.0
)))
if
((
null_value
=
args
[
0
]
->
null_value
))
return
0.0
;
if
((
null_value
=
value
<=
0.0
))
{
signal_divide_by_null
();
return
0.0
;
}
if
(
arg_count
==
2
)
{
double
value2
=
args
[
1
]
->
val_real
();
if
((
null_value
=
(
args
[
1
]
->
null_value
||
value2
<=
0.0
||
value
==
1.0
)
))
if
((
null_value
=
args
[
1
]
->
null_value
))
return
0.0
;
if
((
null_value
=
value2
<=
0.0
)
||
(
value
==
1.0
))
{
signal_divide_by_null
();
return
0.0
;
}
return
log
(
value2
)
/
log
(
value
);
}
return
log
(
value
);
...
...
@@ -1416,8 +1431,14 @@ double Item_func_log2::val_real()
{
DBUG_ASSERT
(
fixed
==
1
);
double
value
=
args
[
0
]
->
val_real
();
if
((
null_value
=
(
args
[
0
]
->
null_value
||
value
<=
0.0
)))
if
((
null_value
=
args
[
0
]
->
null_value
))
return
0.0
;
if
((
null_value
=
value
<=
0.0
))
{
signal_divide_by_null
();
return
0.0
;
}
return
log
(
value
)
/
M_LN2
;
}
...
...
@@ -1425,8 +1446,13 @@ double Item_func_log10::val_real()
{
DBUG_ASSERT
(
fixed
==
1
);
double
value
=
args
[
0
]
->
val_real
();
if
((
null_value
=
(
args
[
0
]
->
null_value
||
value
<=
0.0
)))
return
0.0
;
/* purecov: inspected */
if
((
null_value
=
args
[
0
]
->
null_value
))
return
0.0
;
if
((
null_value
=
value
<=
0.0
))
{
signal_divide_by_null
();
return
0.0
;
}
return
log10
(
value
);
}
...
...
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