func_math.result
来自「视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.」· RESULT 代码 · 共 326 行
RESULT
326 行
drop table if exists t1;select floor(5.5),floor(-5.5);floor(5.5) floor(-5.5)5 -6explain extended select floor(5.5),floor(-5.5);id select_type table type possible_keys key key_len ref rows Extra1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables usedWarnings:Note 1003 select floor(5.5) AS `floor(5.5)`,floor(-(5.5)) AS `floor(-5.5)`select ceiling(5.5),ceiling(-5.5);ceiling(5.5) ceiling(-5.5)6 -5explain extended select ceiling(5.5),ceiling(-5.5);id select_type table type possible_keys key key_len ref rows Extra1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables usedWarnings:Note 1003 select ceiling(5.5) AS `ceiling(5.5)`,ceiling(-(5.5)) AS `ceiling(-5.5)`select truncate(52.64,1),truncate(52.64,2),truncate(52.64,-1),truncate(52.64,-2), truncate(-52.64,1),truncate(-52.64,-1);truncate(52.64,1) truncate(52.64,2) truncate(52.64,-1) truncate(52.64,-2) truncate(-52.64,1) truncate(-52.64,-1)52.6 52.64 50 0 -52.6 -50explain extended select truncate(52.64,1),truncate(52.64,2),truncate(52.64,-1),truncate(52.64,-2), truncate(-52.64,1),truncate(-52.64,-1);id select_type table type possible_keys key key_len ref rows Extra1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables usedWarnings:Note 1003 select truncate(52.64,1) AS `truncate(52.64,1)`,truncate(52.64,2) AS `truncate(52.64,2)`,truncate(52.64,-(1)) AS `truncate(52.64,-1)`,truncate(52.64,-(2)) AS `truncate(52.64,-2)`,truncate(-(52.64),1) AS `truncate(-52.64,1)`,truncate(-(52.64),-(1)) AS `truncate(-52.64,-1)`select round(5.5),round(-5.5);round(5.5) round(-5.5)6 -6explain extended select round(5.5),round(-5.5);id select_type table type possible_keys key key_len ref rows Extra1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables usedWarnings:Note 1003 select round(5.5,0) AS `round(5.5)`,round(-(5.5),0) AS `round(-5.5)`select round(5.64,1),round(5.64,2),round(5.64,-1),round(5.64,-2);round(5.64,1) round(5.64,2) round(5.64,-1) round(5.64,-2)5.6 5.64 10 0select abs(-10), sign(-5), sign(5), sign(0);abs(-10) sign(-5) sign(5) sign(0)10 -1 1 0explain extended select abs(-10), sign(-5), sign(5), sign(0);id select_type table type possible_keys key key_len ref rows Extra1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables usedWarnings:Note 1003 select abs(-(10)) AS `abs(-10)`,sign(-(5)) AS `sign(-5)`,sign(5) AS `sign(5)`,sign(0) AS `sign(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 10 NULL NULL NULL 2 NULL NULLexplain extended 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);id select_type table type possible_keys key key_len ref rows Extra1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables usedWarnings:Note 1003 select log(exp(10)) AS `log(exp(10))`,exp((log(sqrt(10)) * 2)) AS `exp(log(sqrt(10))*2)`,log(-(1)) AS `log(-1)`,log(NULL) AS `log(NULL)`,log(1,1) AS `log(1,1)`,log(3,9) AS `log(3,9)`,log(-(1),2) AS `log(-1,2)`,log(NULL,2) AS `log(NULL,2)`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 10 NULL NULL NULLexplain extended select ln(exp(10)),exp(ln(sqrt(10))*2),ln(-1),ln(0),ln(NULL);id select_type table type possible_keys key key_len ref rows Extra1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables usedWarnings:Note 1003 select ln(exp(10)) AS `ln(exp(10))`,exp((ln(sqrt(10)) * 2)) AS `exp(ln(sqrt(10))*2)`,ln(-(1)) AS `ln(-1)`,ln(0) AS `ln(0)`,ln(NULL) AS `ln(NULL)`select log2(8),log2(15),log2(-2),log2(0),log2(NULL);log2(8) log2(15) log2(-2) log2(0) log2(NULL)3 3.9068905956085 NULL NULL NULLexplain extended select log2(8),log2(15),log2(-2),log2(0),log2(NULL);id select_type table type possible_keys key key_len ref rows Extra1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables usedWarnings:Note 1003 select log2(8) AS `log2(8)`,log2(15) AS `log2(15)`,log2(-(2)) AS `log2(-2)`,log2(0) AS `log2(0)`,log2(NULL) AS `log2(NULL)`select log10(100),log10(18),log10(-4),log10(0),log10(NULL);log10(100) log10(18) log10(-4) log10(0) log10(NULL)2 1.2552725051033 NULL NULL NULLexplain extended select log10(100),log10(18),log10(-4),log10(0),log10(NULL);id select_type table type possible_keys key key_len ref rows Extra1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables usedWarnings:Note 1003 select log10(100) AS `log10(100)`,log10(18) AS `log10(18)`,log10(-(4)) AS `log10(-4)`,log10(0) AS `log10(0)`,log10(NULL) AS `log10(NULL)`select pow(10,log10(10)),power(2,4);pow(10,log10(10)) power(2,4)10 16explain extended select pow(10,log10(10)),power(2,4);id select_type table type possible_keys key key_len ref rows Extra1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables usedWarnings:Note 1003 select pow(10,log10(10)) AS `pow(10,log10(10))`,pow(2,4) AS `power(2,4)`set @@rand_seed1=10000000,@@rand_seed2=1000000;select rand(999999),rand();rand(999999) rand()0.014231365187309 0.028870999839968explain extended select rand(999999),rand();id select_type table type possible_keys key key_len ref rows Extra1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables usedWarnings:Note 1003 select rand(999999) AS `rand(999999)`,rand() AS `rand()`select pi(),format(sin(pi()/2),6),format(cos(pi()/2),6),format(abs(tan(pi())),6),format(cot(1),6),format(asin(1),6),format(acos(0),6),format(atan(1),6);pi() format(sin(pi()/2),6) format(cos(pi()/2),6) format(abs(tan(pi())),6) format(cot(1),6) format(asin(1),6) format(acos(0),6) format(atan(1),6)3.141593 1.000000 0.000000 0.000000 0.642093 1.570796 1.570796 0.785398explain extended select pi(),format(sin(pi()/2),6),format(cos(pi()/2),6),format(abs(tan(pi())),6),format(cot(1),6),format(asin(1),6),format(acos(0),6),format(atan(1),6);id select_type table type possible_keys key key_len ref rows Extra1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables usedWarnings:Note 1003 select pi() AS `pi()`,format(sin((pi() / 2)),6) AS `format(sin(pi()/2),6)`,format(cos((pi() / 2)),6) AS `format(cos(pi()/2),6)`,format(abs(tan(pi())),6) AS `format(abs(tan(pi())),6)`,format((1 / tan(1)),6) AS `format(cot(1),6)`,format(asin(1),6) AS `format(asin(1),6)`,format(acos(0),6) AS `format(acos(0),6)`,format(atan(1),6) AS `format(atan(1),6)`select degrees(pi()),radians(360);degrees(pi()) radians(360)180 6.2831853071796SELECT ACOS(1.0);ACOS(1.0)0SELECT ASIN(1.0);ASIN(1.0)1.5707963267949SELECT ACOS(0.2*5.0);ACOS(0.2*5.0)0SELECT ACOS(0.5*2.0);ACOS(0.5*2.0)0SELECT ASIN(0.8+0.2);ASIN(0.8+0.2)1.5707963267949SELECT ASIN(1.2-0.2);ASIN(1.2-0.2)1.5707963267949select format(4.55, 1), format(4.551, 1);format(4.55, 1) format(4.551, 1)4.6 4.6explain extended select degrees(pi()),radians(360);id select_type table type possible_keys key key_len ref rows Extra1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables usedWarnings:Note 1003 select degrees(pi()) AS `degrees(pi())`,radians(360) AS `radians(360)`select rand(rand);ERROR 42S22: Unknown column 'rand' in 'field list'create table t1 (col1 int, col2 decimal(60,30));insert into t1 values(1,1234567890.12345);select format(col2,7) from t1;format(col2,7)1,234,567,890.1234500select format(col2,8) from t1;format(col2,8)1,234,567,890.12345000insert into t1 values(7,1234567890123456.12345);select format(col2,6) from t1 where col1=7;format(col2,6)1,234,567,890,123,456.123450drop table t1;select ceil(0.09);ceil(0.09)1select ceil(0.000000000000000009);ceil(0.000000000000000009)1create table t1 select round(1, 6);show create table t1;Table Create Tablet1 CREATE TABLE `t1` ( `round(1, 6)` int(1) NOT NULL default '0') ENGINE=MyISAM DEFAULT CHARSET=latin1select * from t1;round(1, 6)1drop table t1;select abs(-2) * -2;abs(-2) * -2-4create table t1 (i int);insert into t1 values (1);select rand(i) from t1;ERROR HY000: Incorrect arguments to RANDdrop table t1;create table t1 (a varchar(90), ts datetime not null, index (a)) engine=innodb default charset=utf8;insert into t1 values ('http://www.foo.com/', now());select a from t1 where a='http://www.foo.com/' order by abs(timediff(ts, 0));ahttp://www.foo.com/drop table t1;set sql_mode='traditional';select ln(-1);ln(-1)NULLWarnings:Error 1365 Division by 0select log10(-1);log10(-1)NULLWarnings:Error 1365 Division by 0select log2(-1);log2(-1)NULLWarnings:Error 1365 Division by 0select log(2,-1);log(2,-1)NULLWarnings:Error 1365 Division by 0select log(-2,1);log(-2,1)NULLWarnings:Error 1365 Division by 0set sql_mode='';select round(111,-10);round(111,-10)0select round(-5000111000111000155,-1);round(-5000111000111000155,-1)-5000111000111000160select round(15000111000111000155,-1);round(15000111000111000155,-1)15000111000111000160select truncate(-5000111000111000155,-1);truncate(-5000111000111000155,-1)-5000111000111000150select truncate(15000111000111000155,-1);truncate(15000111000111000155,-1)15000111000111000150set names utf8;create table t1(f1 varchar(32) not null,f2 smallint(5) unsigned not null,f3 int(10) unsigned not null default '0')engine=myisam default charset=utf8;insert into t1 values ('zombie',0,0),('gold',1,10000),('silver',2,10000);create table t2(f1 int(10) unsigned not null,f2 int(10) unsigned not null,f3 smallint(5) unsigned not null)engine=myisam default charset=utf8;insert into t2 values (16777216,16787215,1),(33554432,33564431,2);select format(t2.f2-t2.f1+1,0) from t1,t2where t1.f2 = t2.f3 order by t1.f1;format(t2.f2-t2.f1+1,0)10,00010,000drop table t1, t2;set names default;select cast(-2 as unsigned), 18446744073709551614, -2;cast(-2 as unsigned) 18446744073709551614 -218446744073709551614 18446744073709551614 -2select abs(cast(-2 as unsigned)), abs(18446744073709551614), abs(-2);abs(cast(-2 as unsigned)) abs(18446744073709551614) abs(-2)18446744073709551614 18446744073709551614 2select ceiling(cast(-2 as unsigned)), ceiling(18446744073709551614), ceiling(-2);ceiling(cast(-2 as unsigned)) ceiling(18446744073709551614) ceiling(-2)18446744073709551614 18446744073709551614 -2select floor(cast(-2 as unsigned)), floor(18446744073709551614), floor(-2);floor(cast(-2 as unsigned)) floor(18446744073709551614) floor(-2)18446744073709551614 18446744073709551614 -2select format(cast(-2 as unsigned), 2), format(18446744073709551614, 2), format(-2, 2);format(cast(-2 as unsigned), 2) format(18446744073709551614, 2) format(-2, 2)18,446,744,073,709,551,614.00 18,446,744,073,709,551,614.00 -2.00select sqrt(cast(-2 as unsigned)), sqrt(18446744073709551614), sqrt(-2);sqrt(cast(-2 as unsigned)) sqrt(18446744073709551614) sqrt(-2)4294967296 4294967296 NULLselect round(cast(-2 as unsigned), 1), round(18446744073709551614, 1), round(-2, 1);round(cast(-2 as unsigned), 1) round(18446744073709551614, 1) round(-2, 1)18446744073709551614 18446744073709551614 -2select round(4, cast(-2 as unsigned)), round(4, 18446744073709551614), round(4, -2);round(4, cast(-2 as unsigned)) round(4, 18446744073709551614) round(4, -2)4 4 0select truncate(cast(-2 as unsigned), 1), truncate(18446744073709551614, 1), truncate(-2, 1);truncate(cast(-2 as unsigned), 1) truncate(18446744073709551614, 1) truncate(-2, 1)18446744073709551614 18446744073709551614 -2select truncate(4, cast(-2 as unsigned)), truncate(4, 18446744073709551614), truncate(4, -2);truncate(4, cast(-2 as unsigned)) truncate(4, 18446744073709551614) truncate(4, -2)4 4 0select round(10000000000000000000, -19), truncate(10000000000000000000, -19);round(10000000000000000000, -19) truncate(10000000000000000000, -19)10000000000000000000 10000000000000000000select round(1e0, -309), truncate(1e0, -309);round(1e0, -309) truncate(1e0, -309)0 0select round(1e1,308), truncate(1e1, 308);round(1e1,308) truncate(1e1, 308)10 10select round(1e1, 2147483648), truncate(1e1, 2147483648);round(1e1, 2147483648) truncate(1e1, 2147483648)10 10select round(1.1e1, 4294967295), truncate(1.1e1, 4294967295);round(1.1e1, 4294967295) truncate(1.1e1, 4294967295)11 11select round(1.12e1, 4294967296), truncate(1.12e1, 4294967296);round(1.12e1, 4294967296) truncate(1.12e1, 4294967296)11.2 11.2select round(1.5, 2147483640), truncate(1.5, 2147483640);round(1.5, 2147483640) truncate(1.5, 2147483640)1.500000000000000000000000000000 1.500000000000000000000000000000select round(1.5, -2147483649), round(1.5, 2147483648);round(1.5, -2147483649) round(1.5, 2147483648)0 1.500000000000000000000000000000select truncate(1.5, -2147483649), truncate(1.5, 2147483648);truncate(1.5, -2147483649) truncate(1.5, 2147483648)0 1.500000000000000000000000000000select round(1.5, -4294967296), round(1.5, 4294967296);round(1.5, -4294967296) round(1.5, 4294967296)0 1.500000000000000000000000000000select truncate(1.5, -4294967296), truncate(1.5, 4294967296);truncate(1.5, -4294967296) truncate(1.5, 4294967296)0 1.500000000000000000000000000000select round(1.5, -9223372036854775808), round(1.5, 9223372036854775808);round(1.5, -9223372036854775808) round(1.5, 9223372036854775808)0 1.500000000000000000000000000000select truncate(1.5, -9223372036854775808), truncate(1.5, 9223372036854775808);truncate(1.5, -9223372036854775808) truncate(1.5, 9223372036854775808)0 1.500000000000000000000000000000select round(1.5, 18446744073709551615), truncate(1.5, 18446744073709551615);round(1.5, 18446744073709551615) truncate(1.5, 18446744073709551615)1.500000000000000000000000000000 1.500000000000000000000000000000select round(18446744073709551614, -1), truncate(18446744073709551614, -1);round(18446744073709551614, -1) truncate(18446744073709551614, -1)18446744073709551610 18446744073709551610select round(4, -4294967200), truncate(4, -4294967200);round(4, -4294967200) truncate(4, -4294967200)0 0select mod(cast(-2 as unsigned), 3), mod(18446744073709551614, 3), mod(-2, 3);mod(cast(-2 as unsigned), 3) mod(18446744073709551614, 3) mod(-2, 3)2 2 -2select mod(5, cast(-2 as unsigned)), mod(5, 18446744073709551614), mod(5, -2);mod(5, cast(-2 as unsigned)) mod(5, 18446744073709551614) mod(5, -2)5 5 1select pow(cast(-2 as unsigned), 5), pow(18446744073709551614, 5), pow(-2, 5);pow(cast(-2 as unsigned), 5) pow(18446744073709551614, 5) pow(-2, 5)2.1359870359209e+96 2.1359870359209e+96 -32End of 5.0 tests
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?