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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
7213fd02
Commit
7213fd02
authored
Jul 19, 2002
by
peter@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge changes in docs do go further
parents
381d56bb
684bf18e
Changes
13
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
145 additions
and
23 deletions
+145
-23
BitKeeper/etc/logging_ok
BitKeeper/etc/logging_ok
+4
-3
Docs/manual.texi
Docs/manual.texi
+50
-3
mysql-test/r/func_math.result
mysql-test/r/func_math.result
+12
-3
mysql-test/t/func_math.test
mysql-test/t/func_math.test
+4
-1
sql/gen_lex_hash.cc
sql/gen_lex_hash.cc
+4
-4
sql/item_create.cc
sql/item_create.cc
+7
-2
sql/item_create.h
sql/item_create.h
+2
-1
sql/item_func.cc
sql/item_func.cc
+30
-1
sql/item_func.h
sql/item_func.h
+20
-0
sql/lex.h
sql/lex.h
+3
-1
sql/sql_yacc.yy
sql/sql_yacc.yy
+5
-0
tests/function.res
tests/function.res
+3
-3
tests/function.tst
tests/function.tst
+1
-1
No files found.
BitKeeper/etc/logging_ok
View file @
7213fd02
...
@@ -45,7 +45,10 @@ nick@nick.leippe.com
...
@@ -45,7 +45,10 @@ nick@nick.leippe.com
paul@central.snake.net
paul@central.snake.net
paul@teton.kitebird.com
paul@teton.kitebird.com
peter@linux.local
peter@linux.local
peter@mysql.com
root@x3.internalnet
root@x3.internalnet
salle@geopard.(none)
salle@geopard.online.bg
sasha@mysql.sashanet.com
sasha@mysql.sashanet.com
serg@serg.mysql.com
serg@serg.mysql.com
serg@sergbook.mysql.com
serg@sergbook.mysql.com
...
@@ -64,10 +67,8 @@ tonu@volk.internalnet
...
@@ -64,10 +67,8 @@ tonu@volk.internalnet
tonu@x153.internalnet
tonu@x153.internalnet
tonu@x3.internalnet
tonu@x3.internalnet
venu@work.mysql.com
venu@work.mysql.com
walrus@mysql.com
worm@altair.is.lan
worm@altair.is.lan
zak@balfor.local
zak@balfor.local
zak@linux.local
zak@linux.local
salle@geopard.(none)
walrus@mysql.com
zgreant@mysql.com
zgreant@mysql.com
salle@geopard.online.bg
Docs/manual.texi
View file @
7213fd02
...
@@ -31885,17 +31885,58 @@ mysql> SELECT EXP(2);
...
@@ -31885,17 +31885,58 @@ mysql> SELECT EXP(2);
mysql> SELECT EXP(-2);
mysql> SELECT EXP(-2);
-> 0.135335
-> 0.135335
@end example
@end example
@findex LOG()
@item LOG(X)
@findex LN()
@item LN(X)
Returns the natural logarithm of @code{X}:
Returns the natural logarithm of @code{X}:
@example
@example
mysql> SELECT LN(2);
-> 0.693147
mysql> SELECT LN(-2);
-> NULL
@end example
This function was added in MySQL version 4.0.3.
It is synonymous with @code{LOG(X)} in MySQL.
@findex LOG()
@item LOG([B,]X)
When called with one parameter, this function returns the natural logarithm
of @code{X}:
@example
mysql> SELECT LOG(2);
mysql> SELECT LOG(2);
-> 0.693147
-> 0.693147
mysql> SELECT LOG(-2);
mysql> SELECT LOG(-2);
-> NULL
-> NULL
@end example
@end example
If you want the log of a number @code{X} to some arbitrary base @code{B}, use
If you want the log of a number @code{X} to some arbitrary base @code{B}, use
the formula @code{LOG(X)/LOG(B)}.
When called with two parameters, this function returns the logarithm of
@code{X} for an arbitary base @code{B}:
@example
mysql> SELECT LOG(2,65536);
-> 16.000000
mysql> SELECT LOG(1,100);
-> NULL
@end example
The arbitrary base option was added in MySQL version 4.0.3.
@code{LOG(B,X)} is equivalent to @code{LOG(X)/LOG(B)}.
@findex LOG2()
@item LOG2(X)
Returns the base-2 logarithm of @code{X}:
@example
mysql> SELECT LOG2(65536);
-> 16.000000
mysql> SELECT LOG2(-100);
-> NULL
@end example
@code{LOG2()} is useful for finding out how many bits a number would
require for storage.
This function was added in MySQL version 4.0.3.
In earlier versions, you can use @code{LOG(X)/LOG(2)} instead.
@findex LOG10()
@findex LOG10()
@item LOG10(X)
@item LOG10(X)
...
@@ -49699,6 +49740,12 @@ Our TODO section contains what we plan to have in 4.0. @xref{TODO MySQL 4.0}.
...
@@ -49699,6 +49740,12 @@ Our TODO section contains what we plan to have in 4.0. @xref{TODO MySQL 4.0}.
@itemize @bullet
@itemize @bullet
@item
@item
Fixed a bug that made the pager option in the mysql client non-functional.
Fixed a bug that made the pager option in the mysql client non-functional.
Extended @code{LOG()} function to accept an optional arbitrary base parameter.
@xref{Mathematical functions}.
@item
Added @code{LOG2()} function (useful for finding out how many bits a number would require for storage).
@item
Added @code{LN()} natural logarithm function for compatibility with other databases. It is synonymous with @code{LOG(X)}.
@end itemize
@end itemize
mysql-test/r/func_math.result
View file @
7213fd02
...
@@ -16,9 +16,18 @@ round(5.64,1) round(5.64,2) round(5.64,-1) round(5.64,-2)
...
@@ -16,9 +16,18 @@ round(5.64,1) round(5.64,2) round(5.64,-1) round(5.64,-2)
select abs(-10), sign(-5), sign(5), sign(0);
select abs(-10), sign(-5), sign(5), sign(0);
abs(-10) sign(-5) sign(5) sign(0)
abs(-10) sign(-5) sign(5) sign(0)
10 -1 1 0
10 -1 1 0
select log(exp(10)),exp(log(sqrt(10))*2);
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(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
10.000000 10.000000 NULL NULL NULL 2.000000 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.000000 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
select log10(100),log10(18),log10(-4),log10(0),log10(NULL);
log10(100) log10(18) log10(-4) log10(0) log10(NULL)
2.000000 1.255273 NULL NULL NULL
select pow(10,log10(10)),power(2,4);
select pow(10,log10(10)),power(2,4);
pow(10,log10(10)) power(2,4)
pow(10,log10(10)) power(2,4)
10.000000 16.000000
10.000000 16.000000
...
...
mysql-test/t/func_math.test
View file @
7213fd02
...
@@ -8,7 +8,10 @@ select truncate(52.64,1),truncate(52.64,2),truncate(52.64,-1),truncate(52.64,-2)
...
@@ -8,7 +8,10 @@ select truncate(52.64,1),truncate(52.64,2),truncate(52.64,-1),truncate(52.64,-2)
select
round
(
5.5
),
round
(
-
5.5
);
select
round
(
5.5
),
round
(
-
5.5
);
select
round
(
5.64
,
1
),
round
(
5.64
,
2
),
round
(
5.64
,
-
1
),
round
(
5.64
,
-
2
);
select
round
(
5.64
,
1
),
round
(
5.64
,
2
),
round
(
5.64
,
-
1
),
round
(
5.64
,
-
2
);
select
abs
(
-
10
),
sign
(
-
5
),
sign
(
5
),
sign
(
0
);
select
abs
(
-
10
),
sign
(
-
5
),
sign
(
5
),
sign
(
0
);
select
log
(
exp
(
10
)),
exp
(
log
(
sqrt
(
10
))
*
2
);
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
);
select
ln
(
exp
(
10
)),
exp
(
ln
(
sqrt
(
10
))
*
2
),
ln
(
-
1
),
ln
(
0
),
ln
(
NULL
);
select
log2
(
8
),
log2
(
15
),
log2
(
-
2
),
log2
(
0
),
log2
(
NULL
);
select
log10
(
100
),
log10
(
18
),
log10
(
-
4
),
log10
(
0
),
log10
(
NULL
);
select
pow
(
10
,
log10
(
10
)),
power
(
2
,
4
);
select
pow
(
10
,
log10
(
10
)),
power
(
2
,
4
);
select
rand
(
999999
),
rand
();
select
rand
(
999999
),
rand
();
select
pi
(),
sin
(
pi
()
/
2
),
cos
(
pi
()
/
2
),
abs
(
tan
(
pi
())),
cot
(
1
),
asin
(
1
),
acos
(
0
),
atan
(
1
);
select
pi
(),
sin
(
pi
()
/
2
),
cos
(
pi
()
/
2
),
abs
(
tan
(
pi
())),
cot
(
1
),
asin
(
1
),
acos
(
0
),
atan
(
1
);
...
...
sql/gen_lex_hash.cc
View file @
7213fd02
...
@@ -74,13 +74,13 @@ static struct my_option my_long_options[] =
...
@@ -74,13 +74,13 @@ static struct my_option my_long_options[] =
{
"version"
,
'V'
,
"Output version information and exit"
,
{
"version"
,
'V'
,
"Output version information and exit"
,
0
,
0
,
0
,
GET_NO_ARG
,
NO_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
0
,
0
,
0
,
GET_NO_ARG
,
NO_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
{
"rnd1"
,
'r'
,
"Set 1 part of rnd value for hash generator"
,
{
"rnd1"
,
'r'
,
"Set 1 part of rnd value for hash generator"
,
(
gptr
*
)
&
best_t1
,
(
gptr
*
)
&
best_t1
,
0
,
GET_ULONG
,
REQUIRED_ARG
,
665702
5L
,
(
gptr
*
)
&
best_t1
,
(
gptr
*
)
&
best_t1
,
0
,
GET_ULONG
,
REQUIRED_ARG
,
507563
5L
,
0
,
0
,
0
,
0
,
0
},
0
,
0
,
0
,
0
,
0
},
{
"rnd2"
,
'R'
,
"Set 2 part of rnd value for hash generator"
,
{
"rnd2"
,
'R'
,
"Set 2 part of rnd value for hash generator"
,
(
gptr
*
)
&
best_t2
,
(
gptr
*
)
&
best_t2
,
0
,
GET_ULONG
,
REQUIRED_ARG
,
6114496
L
,
(
gptr
*
)
&
best_t2
,
(
gptr
*
)
&
best_t2
,
0
,
GET_ULONG
,
REQUIRED_ARG
,
1345933
L
,
0
,
0
,
0
,
0
,
0
},
0
,
0
,
0
,
0
,
0
},
{
"type"
,
't'
,
"Set type of char table to generate"
,
{
"type"
,
't'
,
"Set type of char table to generate"
,
(
gptr
*
)
&
best_type
,
(
gptr
*
)
&
best_type
,
0
,
GET_UINT
,
REQUIRED_ARG
,
1
,
0
,
0
,
(
gptr
*
)
&
best_type
,
(
gptr
*
)
&
best_type
,
0
,
GET_UINT
,
REQUIRED_ARG
,
4
,
0
,
0
,
0
,
0
,
0
},
0
,
0
,
0
},
{
0
,
0
,
0
,
0
,
0
,
0
,
GET_NO_ARG
,
NO_ARG
,
0
,
0
,
0
,
0
,
0
,
0
}
{
0
,
0
,
0
,
0
,
0
,
0
,
GET_NO_ARG
,
NO_ARG
,
0
,
0
,
0
,
0
,
0
,
0
}
};
};
...
@@ -479,7 +479,7 @@ int main(int argc,char **argv)
...
@@ -479,7 +479,7 @@ int main(int argc,char **argv)
MY_INIT
(
argv
[
0
]);
MY_INIT
(
argv
[
0
]);
start_value
=
1109118L
;
/* mode=4903
add=3 type: 0 */
start_value
=
3807640L
;
/* mode=6971
add=3 type: 0 */
if
(
get_options
(
argc
,(
char
**
)
argv
))
if
(
get_options
(
argc
,(
char
**
)
argv
))
exit
(
1
);
exit
(
1
);
...
...
sql/item_create.cc
View file @
7213fd02
...
@@ -220,9 +220,14 @@ Item *create_func_char_length(Item* a)
...
@@ -220,9 +220,14 @@ Item *create_func_char_length(Item* a)
return
new
Item_func_char_length
(
a
);
return
new
Item_func_char_length
(
a
);
}
}
Item
*
create_func_l
og
(
Item
*
a
)
Item
*
create_func_l
n
(
Item
*
a
)
{
{
return
new
Item_func_log
(
a
);
return
new
Item_func_ln
(
a
);
}
Item
*
create_func_log2
(
Item
*
a
)
{
return
new
Item_func_log2
(
a
);
}
}
Item
*
create_func_log10
(
Item
*
a
)
Item
*
create_func_log10
(
Item
*
a
)
...
...
sql/item_create.h
View file @
7213fd02
...
@@ -52,8 +52,9 @@ Item *create_func_instr(Item* a, Item *b);
...
@@ -52,8 +52,9 @@ Item *create_func_instr(Item* a, Item *b);
Item
*
create_func_isnull
(
Item
*
a
);
Item
*
create_func_isnull
(
Item
*
a
);
Item
*
create_func_lcase
(
Item
*
a
);
Item
*
create_func_lcase
(
Item
*
a
);
Item
*
create_func_length
(
Item
*
a
);
Item
*
create_func_length
(
Item
*
a
);
Item
*
create_func_ln
(
Item
*
a
);
Item
*
create_func_locate
(
Item
*
a
,
Item
*
b
);
Item
*
create_func_locate
(
Item
*
a
,
Item
*
b
);
Item
*
create_func_log
(
Item
*
a
);
Item
*
create_func_log
2
(
Item
*
a
);
Item
*
create_func_log10
(
Item
*
a
);
Item
*
create_func_log10
(
Item
*
a
);
Item
*
create_func_lpad
(
Item
*
a
,
Item
*
b
,
Item
*
c
);
Item
*
create_func_lpad
(
Item
*
a
,
Item
*
b
,
Item
*
c
);
Item
*
create_func_ltrim
(
Item
*
a
);
Item
*
create_func_ltrim
(
Item
*
a
);
...
...
sql/item_func.cc
View file @
7213fd02
...
@@ -437,14 +437,43 @@ void Item_func_abs::fix_length_and_dec()
...
@@ -437,14 +437,43 @@ void Item_func_abs::fix_length_and_dec()
hybrid_type
=
args
[
0
]
->
result_type
()
==
INT_RESULT
?
INT_RESULT
:
REAL_RESULT
;
hybrid_type
=
args
[
0
]
->
result_type
()
==
INT_RESULT
?
INT_RESULT
:
REAL_RESULT
;
}
}
/* Gateway to natural LOG function */
double
Item_func_ln
::
val
()
{
double
value
=
args
[
0
]
->
val
();
if
((
null_value
=
(
args
[
0
]
->
null_value
||
value
<=
0.0
)))
return
0.0
;
return
log
(
value
);
}
/*
Extended but so slower LOG function
We have to check if all values are > zero and first one is not one
as these are the cases then result is not a number.
*/
double
Item_func_log
::
val
()
double
Item_func_log
::
val
()
{
{
double
value
=
args
[
0
]
->
val
();
double
value
=
args
[
0
]
->
val
();
if
((
null_value
=
(
args
[
0
]
->
null_value
||
value
<=
0.0
)))
if
((
null_value
=
(
args
[
0
]
->
null_value
||
value
<=
0.0
)))
return
0.0
;
/* purecov: inspected */
return
0.0
;
if
(
arg_count
==
2
)
{
double
value2
=
args
[
1
]
->
val
();
if
((
null_value
=
(
args
[
1
]
->
null_value
||
value2
<=
0.0
||
value
==
1.0
)))
return
0.0
;
return
log
(
value2
)
/
log
(
value
);
}
return
log
(
value
);
return
log
(
value
);
}
}
double
Item_func_log2
::
val
()
{
double
value
=
args
[
0
]
->
val
();
if
((
null_value
=
(
args
[
0
]
->
null_value
||
value
<=
0.0
)))
return
0.0
;
return
log
(
value
)
/
log
(
2.0
);
}
double
Item_func_log10
::
val
()
double
Item_func_log10
::
val
()
{
{
double
value
=
args
[
0
]
->
val
();
double
value
=
args
[
0
]
->
val
();
...
...
sql/item_func.h
View file @
7213fd02
...
@@ -338,15 +338,35 @@ class Item_func_exp :public Item_dec_func
...
@@ -338,15 +338,35 @@ class Item_func_exp :public Item_dec_func
const
char
*
func_name
()
const
{
return
"exp"
;
}
const
char
*
func_name
()
const
{
return
"exp"
;
}
};
};
class
Item_func_ln
:
public
Item_dec_func
{
public:
Item_func_ln
(
Item
*
a
)
:
Item_dec_func
(
a
)
{}
double
val
();
const
char
*
func_name
()
const
{
return
"ln"
;
}
};
class
Item_func_log
:
public
Item_dec_func
class
Item_func_log
:
public
Item_dec_func
{
{
public:
public:
Item_func_log
(
Item
*
a
)
:
Item_dec_func
(
a
)
{}
Item_func_log
(
Item
*
a
)
:
Item_dec_func
(
a
)
{}
Item_func_log
(
Item
*
a
,
Item
*
b
)
:
Item_dec_func
(
a
,
b
)
{}
double
val
();
double
val
();
const
char
*
func_name
()
const
{
return
"log"
;
}
const
char
*
func_name
()
const
{
return
"log"
;
}
};
};
class
Item_func_log2
:
public
Item_dec_func
{
public:
Item_func_log2
(
Item
*
a
)
:
Item_dec_func
(
a
)
{}
double
val
();
const
char
*
func_name
()
const
{
return
"log2"
;
}
};
class
Item_func_log10
:
public
Item_dec_func
class
Item_func_log10
:
public
Item_dec_func
{
{
public:
public:
...
...
sql/lex.h
View file @
7213fd02
...
@@ -461,9 +461,11 @@ static SYMBOL sql_functions[] = {
...
@@ -461,9 +461,11 @@ static SYMBOL sql_functions[] = {
{
"LCASE"
,
SYM
(
FUNC_ARG1
),
0
,
CREATE_FUNC
(
create_func_lcase
)},
{
"LCASE"
,
SYM
(
FUNC_ARG1
),
0
,
CREATE_FUNC
(
create_func_lcase
)},
{
"LEAST"
,
SYM
(
LEAST_SYM
),
0
,
0
},
{
"LEAST"
,
SYM
(
LEAST_SYM
),
0
,
0
},
{
"LENGTH"
,
SYM
(
FUNC_ARG1
),
0
,
CREATE_FUNC
(
create_func_length
)},
{
"LENGTH"
,
SYM
(
FUNC_ARG1
),
0
,
CREATE_FUNC
(
create_func_length
)},
{
"LN"
,
SYM
(
FUNC_ARG1
),
0
,
CREATE_FUNC
(
create_func_ln
)},
{
"LOAD_FILE"
,
SYM
(
FUNC_ARG1
),
0
,
CREATE_FUNC
(
create_load_file
)},
{
"LOAD_FILE"
,
SYM
(
FUNC_ARG1
),
0
,
CREATE_FUNC
(
create_load_file
)},
{
"LOCATE"
,
SYM
(
LOCATE
),
0
,
0
},
{
"LOCATE"
,
SYM
(
LOCATE
),
0
,
0
},
{
"LOG"
,
SYM
(
FUNC_ARG1
),
0
,
CREATE_FUNC
(
create_func_log
)},
{
"LOG"
,
SYM
(
LOG_SYM
),
0
,
0
},
{
"LOG2"
,
SYM
(
FUNC_ARG1
),
0
,
CREATE_FUNC
(
create_func_log2
)},
{
"LOG10"
,
SYM
(
FUNC_ARG1
),
0
,
CREATE_FUNC
(
create_func_log10
)},
{
"LOG10"
,
SYM
(
FUNC_ARG1
),
0
,
CREATE_FUNC
(
create_func_log10
)},
{
"LOWER"
,
SYM
(
FUNC_ARG1
),
0
,
CREATE_FUNC
(
create_func_lcase
)},
{
"LOWER"
,
SYM
(
FUNC_ARG1
),
0
,
CREATE_FUNC
(
create_func_lcase
)},
{
"LPAD"
,
SYM
(
FUNC_ARG3
),
0
,
CREATE_FUNC
(
create_func_lpad
)},
{
"LPAD"
,
SYM
(
FUNC_ARG3
),
0
,
CREATE_FUNC
(
create_func_lpad
)},
...
...
sql/sql_yacc.yy
View file @
7213fd02
...
@@ -231,6 +231,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
...
@@ -231,6 +231,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
%token LIKE
%token LIKE
%token LINES
%token LINES
%token LOCAL_SYM
%token LOCAL_SYM
%token LOG_SYM
%token LOGS_SYM
%token LOGS_SYM
%token LONG_NUM
%token LONG_NUM
%token LONG_SYM
%token LONG_SYM
...
@@ -1779,6 +1780,10 @@ simple_expr:
...
@@ -1779,6 +1780,10 @@ simple_expr:
{ $5->push_front($3); $$= new Item_func_max(*$5); }
{ $5->push_front($3); $$= new Item_func_max(*$5); }
| LEAST_SYM '(' expr ',' expr_list ')'
| LEAST_SYM '(' expr ',' expr_list ')'
{ $5->push_front($3); $$= new Item_func_min(*$5); }
{ $5->push_front($3); $$= new Item_func_min(*$5); }
| LOG_SYM '(' expr ')'
{ $$= new Item_func_log($3); }
| LOG_SYM '(' expr ',' expr ')'
{ $$= new Item_func_log($3, $5); }
| MINUTE_SYM '(' expr ')'
| MINUTE_SYM '(' expr ')'
{ $$= new Item_func_minute($3); }
{ $$= new Item_func_minute($3); }
| MONTH_SYM '(' expr ')'
| MONTH_SYM '(' expr ')'
...
...
tests/function.res
View file @
7213fd02
...
@@ -11,11 +11,11 @@ select floor(5.5),floor(-5.5),ceiling(5.5),ceiling(-5.5),round(5.5),round(-5.5)
...
@@ -11,11 +11,11 @@ select floor(5.5),floor(-5.5),ceiling(5.5),ceiling(-5.5),round(5.5),round(-5.5)
floor(5.5) floor(-5.5) ceiling(5.5) ceiling(-5.5) round(5.5) round(-5.5)
floor(5.5) floor(-5.5) ceiling(5.5) ceiling(-5.5) round(5.5) round(-5.5)
5 -6 6 -5 6 -6
5 -6 6 -5 6 -6
--------------
--------------
select abs(-10),log(exp(10)),exp(log(sqrt(10))*2),pow(10,log10(10)),rand(999999),rand()
select abs(-10),log(exp(10)),
ln(exp(10)),log2(65535),log(2,65535),
exp(log(sqrt(10))*2),pow(10,log10(10)),rand(999999),rand()
--------------
--------------
abs(-10) log(exp(10)) exp(log(sqrt(10))*2) pow(10,log10(10)) rand(999999) rand()
abs(-10) log(exp(10))
ln(exp(10)) log2(65535) log(2,65535)
exp(log(sqrt(10))*2) pow(10,log10(10)) rand(999999) rand()
10 10.000000 10.000000 10.000000 0.1844 0.7637
10 10.000000 10.000000
2.000000 2.000000 10.000000
10.000000 0.1844 0.7637
--------------
--------------
select least(6,1.0,2.0),greatest(3,4,5,0)
select least(6,1.0,2.0),greatest(3,4,5,0)
--------------
--------------
...
...
tests/function.tst
View file @
7213fd02
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
#
#
select 1+1,1-1,1+1*2,8/5,8%5,mod(8,5),mod(8,5)|0,-(1+1)*-2,sign(-5) ;
select 1+1,1-1,1+1*2,8/5,8%5,mod(8,5),mod(8,5)|0,-(1+1)*-2,sign(-5) ;
select floor(5.5),floor(-5.5),ceiling(5.5),ceiling(-5.5),round(5.5),round(-5.5);
select floor(5.5),floor(-5.5),ceiling(5.5),ceiling(-5.5),round(5.5),round(-5.5);
select abs(-10),log(exp(10)),exp(log(sqrt(10))*2),pow(10,log10(10)),rand(999999),rand();
select abs(-10),log(exp(10)),
ln(exp(10)),log2(65535),log(2,65535),
exp(log(sqrt(10))*2),pow(10,log10(10)),rand(999999),rand();
select least(6,1.0,2.0),greatest(3,4,5,0) ;
select least(6,1.0,2.0),greatest(3,4,5,0) ;
select 1 | (1+1),5 & 3,bit_count(7) ;
select 1 | (1+1),5 & 3,bit_count(7) ;
#
#
...
...
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