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
9d734728
Commit
9d734728
authored
20 years ago
by
konstantin@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/media/sda1/mysql/mysql-4.1-6059
parents
a55e6dda
13665252
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
8 deletions
+27
-8
mysql-test/r/func_test.result
mysql-test/r/func_test.result
+9
-0
mysql-test/t/func_test.test
mysql-test/t/func_test.test
+13
-0
sql/item_func.cc
sql/item_func.cc
+5
-8
No files found.
mysql-test/r/func_test.result
View file @
9d734728
...
@@ -174,3 +174,12 @@ SELECT GREATEST(d,d) FROM t1 WHERE k=2;
...
@@ -174,3 +174,12 @@ SELECT GREATEST(d,d) FROM t1 WHERE k=2;
GREATEST(d,d)
GREATEST(d,d)
NULL
NULL
DROP TABLE t1;
DROP TABLE t1;
select 1197.90 mod 50;
1197.90 mod 50
47.90
select 5.1 mod 3, 5.1 mod -3, -5.1 mod 3, -5.1 mod -3;
5.1 mod 3 5.1 mod -3 -5.1 mod 3 -5.1 mod -3
2.1 2.1 -2.1 -2.1
select 5 mod 3, 5 mod -3, -5 mod 3, -5 mod -3;
5 mod 3 5 mod -3 -5 mod 3 -5 mod -3
2 2 -2 -2
This diff is collapsed.
Click to expand it.
mysql-test/t/func_test.test
View file @
9d734728
...
@@ -94,3 +94,16 @@ CREATE TABLE t1 (d varchar(6), k int);
...
@@ -94,3 +94,16 @@ CREATE TABLE t1 (d varchar(6), k int);
INSERT
INTO
t1
VALUES
(
NULL
,
2
);
INSERT
INTO
t1
VALUES
(
NULL
,
2
);
SELECT
GREATEST
(
d
,
d
)
FROM
t1
WHERE
k
=
2
;
SELECT
GREATEST
(
d
,
d
)
FROM
t1
WHERE
k
=
2
;
DROP
TABLE
t1
;
DROP
TABLE
t1
;
#
# Bug #6138: mod and doubles
#
select
1197.90
mod
50
;
select
5.1
mod
3
,
5.1
mod
-
3
,
-
5.1
mod
3
,
-
5.1
mod
-
3
;
#
# Test for mod and signed integers
#
select
5
mod
3
,
5
mod
-
3
,
-
5
mod
3
,
-
5
mod
-
3
;
This diff is collapsed.
Click to expand it.
sql/item_func.cc
View file @
9d734728
...
@@ -651,11 +651,11 @@ void Item_func_int_div::fix_length_and_dec()
...
@@ -651,11 +651,11 @@ void Item_func_int_div::fix_length_and_dec()
double
Item_func_mod
::
val
()
double
Item_func_mod
::
val
()
{
{
DBUG_ASSERT
(
fixed
==
1
);
DBUG_ASSERT
(
fixed
==
1
);
double
value
=
floor
(
args
[
0
]
->
val
()
+
0.5
);
double
x
=
args
[
0
]
->
val
(
);
double
val2
=
floor
(
args
[
1
]
->
val
()
+
0.5
);
double
y
=
args
[
1
]
->
val
(
);
if
((
null_value
=
val2
==
0.0
||
args
[
0
]
->
null_value
||
args
[
1
]
->
null_value
))
if
((
null_value
=
(
y
==
0.0
)
||
args
[
0
]
->
null_value
||
args
[
1
]
->
null_value
))
return
0.0
;
/* purecov: inspected */
return
0.0
;
/* purecov: inspected */
return
fmod
(
value
,
val2
);
return
fmod
(
x
,
y
);
}
}
longlong
Item_func_mod
::
val_int
()
longlong
Item_func_mod
::
val_int
()
...
@@ -670,10 +670,7 @@ longlong Item_func_mod::val_int()
...
@@ -670,10 +670,7 @@ longlong Item_func_mod::val_int()
void
Item_func_mod
::
fix_length_and_dec
()
void
Item_func_mod
::
fix_length_and_dec
()
{
{
max_length
=
args
[
1
]
->
max_length
;
Item_num_op
::
fix_length_and_dec
();
decimals
=
0
;
maybe_null
=
1
;
find_num_type
();
}
}
...
...
This diff is collapsed.
Click to expand it.
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