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
9de59ad8
Commit
9de59ad8
authored
Jul 31, 2004
by
guilhem@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge gbichot@bk-internal.mysql.com:/home/bk/mysql-4.0
into mysql.com:/home/mysql_src/mysql-4.0
parents
dd023bc8
22ca5582
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
41 additions
and
23 deletions
+41
-23
mysql-test/mysql-test-run.sh
mysql-test/mysql-test-run.sh
+2
-0
mysql-test/r/func_math.result
mysql-test/r/func_math.result
+12
-12
mysql-test/r/type_float.result
mysql-test/r/type_float.result
+7
-4
mysql-test/t/type_float.test
mysql-test/t/type_float.test
+7
-2
sql/item_func.cc
sql/item_func.cc
+2
-2
sql/item_func.h
sql/item_func.h
+1
-1
sql/item_sum.h
sql/item_sum.h
+10
-2
No files found.
mysql-test/mysql-test-run.sh
View file @
9de59ad8
...
...
@@ -589,6 +589,8 @@ show_failed_diff ()
echo
"Please follow the instructions outlined at"
echo
"http://www.mysql.com/doc/en/Reporting_mysqltest_bugs.html"
echo
"to find the reason to this problem and how to report this."
echo
""
echo
"Test
$1
failed!"
fi
}
...
...
mysql-test/r/func_math.result
View file @
9de59ad8
...
...
@@ -18,44 +18,44 @@ abs(-10) sign(-5) sign(5) sign(0)
10 -1 1 0
select log(exp(10)),exp(log(sqrt(10))*2),log(-1),log(NULL),log(1,1),log(3,9),log(-1,2),log(NULL,2);
log(exp(10)) exp(log(sqrt(10))*2) log(-1) log(NULL) log(1,1) log(3,9) log(-1,2) log(NULL,2)
10
.000000 10.000000 NULL NULL NULL 2.000000
NULL NULL
10
10 NULL NULL NULL 2
NULL NULL
select ln(exp(10)),exp(ln(sqrt(10))*2),ln(-1),ln(0),ln(NULL);
ln(exp(10)) exp(ln(sqrt(10))*2) ln(-1) ln(0) ln(NULL)
10
.000000 10.00000
0 NULL NULL NULL
10
1
0 NULL NULL NULL
select log2(8),log2(15),log2(-2),log2(0),log2(NULL);
log2(8) log2(15) log2(-2) log2(0) log2(NULL)
3
.000000 3.906891
NULL NULL NULL
3
3.9068905956085
NULL NULL NULL
select log10(100),log10(18),log10(-4),log10(0),log10(NULL);
log10(100) log10(18) log10(-4) log10(0) log10(NULL)
2
.000000 1.25527
3 NULL NULL NULL
2
1.255272505103
3 NULL NULL NULL
select pow(10,log10(10)),power(2,4);
pow(10,log10(10)) power(2,4)
10
.000000 16.000000
10
16
set @@rand_seed1=10000000,@@rand_seed2=1000000;
select rand(999999),rand();
rand(999999) rand()
0.014231365187309 0.028870999839968
select pi(),sin(pi()/2),cos(pi()/2),abs(tan(pi())),cot(1),asin(1),acos(0),atan(1);
pi() sin(pi()/2) cos(pi()/2) abs(tan(pi())) cot(1) asin(1) acos(0) atan(1)
3.141593 1
.000000 0.000000 0.000000 0.64209262 1.570796 1.570796 0.785398
3.141593 1
6.1230317691119e-17 1.2246063538224e-16 0.64209261593433 1.5707963267949 1.5707963267949 0.78539816339745
select degrees(pi()),radians(360);
degrees(pi()) radians(360)
180 6.2831853071796
SELECT ACOS(1.0);
ACOS(1.0)
0
.000000
0
SELECT ASIN(1.0);
ASIN(1.0)
1.570796
1.570796
3267949
SELECT ACOS(0.2*5.0);
ACOS(0.2*5.0)
0
.000000
0
SELECT ACOS(0.5*2.0);
ACOS(0.5*2.0)
0
.000000
0
SELECT ASIN(0.8+0.2);
ASIN(0.8+0.2)
1.570796
1.570796
3267949
SELECT ASIN(1.2-0.2);
ASIN(1.2-0.2)
1.570796
1.570796
3267949
mysql-test/r/type_float.result
View file @
9de59ad8
...
...
@@ -72,14 +72,17 @@ insert t1 values (121,"16");
select c1 + c1 * (c2 / 100) as col from t1;
col
140.36
create table t2 select c1 + c1 * (c2 / 100) as col from t1;
create table t2 select c1 + c1 * (c2 / 100) as col
1, round(c1, 5) as col2, round(c1, 35) as col3, sqrt(c1*1e-15) col4
from t1;
select * from t2;
col
140.36
col
1 col2 col3 col4
140.36
121.00000 121 3.47850542618522e-07
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`col` double default NULL
`col1` double default NULL,
`col2` double(22,5) default NULL,
`col3` double default NULL,
`col4` double default NULL
) TYPE=MyISAM
drop table t1,t2;
create table t1 (f float, f2 float(24), f3 float(6,2), d double, d2 float(53), d3 double(10,3), de decimal, de2 decimal(6), de3 decimal(5,2), n numeric, n2 numeric(8), n3 numeric(5,6));
...
...
mysql-test/t/type_float.test
View file @
9de59ad8
...
...
@@ -28,10 +28,14 @@ select a from t1 order by a;
select
min
(
a
)
from
t1
;
drop
table
t1
;
#
# BUG#3612, BUG#4393, BUG#4356, BUG#4394
#
create
table
t1
(
c1
double
,
c2
varchar
(
20
));
insert
t1
values
(
121
,
"16"
);
select
c1
+
c1
*
(
c2
/
100
)
as
col
from
t1
;
create
table
t2
select
c1
+
c1
*
(
c2
/
100
)
as
col
from
t1
;
create
table
t2
select
c1
+
c1
*
(
c2
/
100
)
as
col
1
,
round
(
c1
,
5
)
as
col2
,
round
(
c1
,
35
)
as
col3
,
sqrt
(
c1
*
1
e
-
15
)
col4
from
t1
;
select
*
from
t2
;
show
create
table
t2
;
drop
table
t1
,
t2
;
...
...
@@ -52,6 +56,7 @@ drop table t1;
# Errors
!
$
1063
create
table
t1
(
f
float
(
54
));
# Should give an error
--
error
1063
create
table
t1
(
f
float
(
54
));
# Should give an error
drop
table
if
exists
t1
;
sql/item_func.cc
View file @
9de59ad8
...
...
@@ -684,7 +684,7 @@ void Item_func_round::fix_length_and_dec()
if
(
tmp
<
0
)
decimals
=
0
;
else
decimals
=
tmp
;
decimals
=
min
(
tmp
,
NOT_FIXED_DEC
)
;
}
}
...
...
@@ -1286,7 +1286,7 @@ udf_handler::fix_fields(THD *thd,TABLE_LIST *tables,Item_result_field *func,
func
->
max_length
=
min
(
initid
.
max_length
,
MAX_BLOB_WIDTH
);
func
->
maybe_null
=
initid
.
maybe_null
;
const_item_cache
=
initid
.
const_item
;
func
->
decimals
=
min
(
initid
.
decimals
,
31
);
func
->
decimals
=
min
(
initid
.
decimals
,
NOT_FIXED_DEC
);
}
initialized
=
1
;
if
(
error
)
...
...
sql/item_func.h
View file @
9de59ad8
...
...
@@ -295,7 +295,7 @@ class Item_dec_func :public Item_real_func
Item_dec_func
(
Item
*
a
,
Item
*
b
)
:
Item_real_func
(
a
,
b
)
{}
void
fix_length_and_dec
()
{
decimals
=
6
;
max_length
=
float_length
(
decimals
);
decimals
=
NOT_FIXED_DEC
;
max_length
=
float_length
(
decimals
);
maybe_null
=
1
;
}
inline
double
fix_result
(
double
value
)
...
...
sql/item_sum.h
View file @
9de59ad8
...
...
@@ -234,7 +234,11 @@ public:
class
Item_sum_avg
:
public
Item_sum_num
{
void
fix_length_and_dec
()
{
decimals
+=
4
;
maybe_null
=
1
;
}
void
fix_length_and_dec
()
{
decimals
=
min
(
decimals
+
4
,
NOT_FIXED_DEC
);
maybe_null
=
1
;
}
double
sum
;
ulonglong
count
;
...
...
@@ -276,7 +280,11 @@ class Item_sum_std :public Item_sum_num
double
sum
;
double
sum_sqr
;
ulonglong
count
;
void
fix_length_and_dec
()
{
decimals
+=
4
;
maybe_null
=
1
;
}
void
fix_length_and_dec
()
{
decimals
=
min
(
decimals
+
4
,
NOT_FIXED_DEC
);
maybe_null
=
1
;
}
public:
Item_sum_std
(
Item
*
item_par
)
:
Item_sum_num
(
item_par
),
count
(
0
)
{}
...
...
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