~jaypipes/drizzle/proto-definitions

« back to all changes in this revision

Viewing changes to tests/r/func_math.result

  • Committer: Jay Pipes
  • Date: 2008-09-25 18:13:26 UTC
  • mfrom: (352.5.30 codestyle)
  • Revision ID: jay@mysql.com-20080925181326-2z7pr377hcvf28qt
Merged in trunk and added additional definition wrappers for proto buffer messages

Show diffs side-by-side

added added

removed removed

Lines of Context:
45
45
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);
46
46
log(exp(10))    exp(log(sqrt(10))*2)    log(-1) log(NULL)       log(1,1)        log(3,9)        log(-1,2)       log(NULL,2)
47
47
10      10.000000000000002      NULL    NULL    NULL    2       NULL    NULL
 
48
Warnings:
 
49
Error   1365    Division by 0
 
50
Error   1365    Division by 0
 
51
Error   1365    Division by 0
48
52
explain 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);
49
53
id      select_type     table   type    possible_keys   key     key_len ref     rows    filtered        Extra
50
54
1       SIMPLE  NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    No tables used
53
57
select ln(exp(10)),exp(ln(sqrt(10))*2),ln(-1),ln(0),ln(NULL);
54
58
ln(exp(10))     exp(ln(sqrt(10))*2)     ln(-1)  ln(0)   ln(NULL)
55
59
10      10.000000000000002      NULL    NULL    NULL
 
60
Warnings:
 
61
Error   1365    Division by 0
 
62
Error   1365    Division by 0
56
63
explain extended select ln(exp(10)),exp(ln(sqrt(10))*2),ln(-1),ln(0),ln(NULL);
57
64
id      select_type     table   type    possible_keys   key     key_len ref     rows    filtered        Extra
58
65
1       SIMPLE  NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    No tables used
61
68
select log2(8),log2(15),log2(-2),log2(0),log2(NULL);
62
69
log2(8) log2(15)        log2(-2)        log2(0) log2(NULL)
63
70
3       3.9068905956085187      NULL    NULL    NULL
 
71
Warnings:
 
72
Error   1365    Division by 0
 
73
Error   1365    Division by 0
64
74
explain extended select log2(8),log2(15),log2(-2),log2(0),log2(NULL);
65
75
id      select_type     table   type    possible_keys   key     key_len ref     rows    filtered        Extra
66
76
1       SIMPLE  NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    No tables used
69
79
select log10(100),log10(18),log10(-4),log10(0),log10(NULL);
70
80
log10(100)      log10(18)       log10(-4)       log10(0)        log10(NULL)
71
81
2       1.255272505103306       NULL    NULL    NULL
 
82
Warnings:
 
83
Error   1365    Division by 0
 
84
Error   1365    Division by 0
72
85
explain extended select log10(100),log10(18),log10(-4),log10(0),log10(NULL);
73
86
id      select_type     table   type    possible_keys   key     key_len ref     rows    filtered        Extra
74
87
1       SIMPLE  NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    No tables used
93
106
Note    1003    select rand(999999) AS `rand(999999)`,rand() AS `rand()`
94
107
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);
95
108
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)
96
 
3.141593        1.000000        0.000000        0.000000        0.642093        1.570796        1.570796        0.785398
 
109
3.141593        NULL    0.000000        0.000000        0.642093        1.570796        1.570796        0.785398
 
110
Warnings:
 
111
Warning 1292    Incorrect datetime value: '2'
97
112
explain 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);
98
113
id      select_type     table   type    possible_keys   key     key_len ref     rows    filtered        Extra
99
114
1       SIMPLE  NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    No tables used
100
115
Warnings:
101
 
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)`
 
116
Note    1003    select pi() AS `pi()`,format(month((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)`
102
117
select degrees(pi()),radians(360);
103
118
degrees(pi())   radians(360)
104
119
180     6.283185307179586
165
180
show create table t1;
166
181
Table   Create Table
167
182
t1      CREATE TABLE `t1` (
168
 
  `round(1, 6)` int(1) NOT NULL DEFAULT '0'
169
 
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
183
  `round(1, 6)` int NOT NULL
 
184
) ENGINE=InnoDB
170
185
select * from t1;
171
186
round(1, 6)
172
187
1
204
219
656     405
205
220
122     405
206
221
645     405
207
 
PREPARE stmt FROM 
208
 
"SELECT CAST(RAND(2) * 1000 AS UNSIGNED), CAST(RAND(?) * 1000 AS UNSIGNED)
209
 
    FROM t1 WHERE a = 1";
210
 
set @var=2;
211
 
EXECUTE stmt USING @var;
212
 
CAST(RAND(2) * 1000 AS UNSIGNED)        CAST(RAND(?) * 1000 AS UNSIGNED)
213
 
656     656
214
 
122     122
215
 
645     645
216
222
DROP TABLE t1;
217
 
create table t1 (a varchar(90), ts datetime not null, index (a)) engine=innodb default charset=utf8;
 
223
create table t1 (a varchar(90), ts datetime not null, index (a)) engine=innodb;
218
224
insert into t1 values ('http://www.foo.com/', now());
219
225
select a from t1 where a='http://www.foo.com/' order by abs(timediff(ts, 0));
220
226
a
221
227
http://www.foo.com/
222
228
drop table t1;
223
 
set sql_mode='traditional';
224
 
select ln(-1);
225
 
ln(-1)
226
 
NULL
227
 
Warnings:
228
 
Error   1365    Division by 0
229
 
select log10(-1);
230
 
log10(-1)
231
 
NULL
232
 
Warnings:
233
 
Error   1365    Division by 0
234
 
select log2(-1);
235
 
log2(-1)
236
 
NULL
237
 
Warnings:
238
 
Error   1365    Division by 0
239
 
select log(2,-1);
240
 
log(2,-1)
241
 
NULL
242
 
Warnings:
243
 
Error   1365    Division by 0
244
 
select log(-2,1);
245
 
log(-2,1)
246
 
NULL
247
 
Warnings:
248
 
Error   1365    Division by 0
249
 
set sql_mode='';
250
229
select round(111,-10);
251
230
round(111,-10)
252
231
0
262
241
select truncate(15000111000111000155,-1);
263
242
truncate(15000111000111000155,-1)
264
243
15000111000111000150
265
 
set names utf8;
266
244
create table t1
267
245
(f1 varchar(32) not null,
268
 
f2 smallint(5) unsigned not null,
269
 
f3 int(10) unsigned not null default '0')
270
 
engine=myisam default charset=utf8;
 
246
f2 smallint unsigned not null,
 
247
f3 int unsigned not null default '0')
 
248
engine=myisam;
271
249
insert into t1 values ('zombie',0,0),('gold',1,10000),('silver',2,10000);
272
250
create table t2
273
 
(f1 int(10) unsigned not null,
274
 
f2 int(10) unsigned not null,
275
 
f3 smallint(5) unsigned not null)
276
 
engine=myisam default charset=utf8;
 
251
(f1 int unsigned not null,
 
252
f2 int unsigned not null,
 
253
f3 smallint unsigned not null)
 
254
engine=myisam;
277
255
insert into t2 values (16777216,16787215,1),(33554432,33564431,2);
278
256
select format(t2.f2-t2.f1+1,0) from t1,t2
279
257
where t1.f2 = t2.f3 order by t1.f1;
281
259
10,000
282
260
10,000
283
261
drop table t1, t2;
284
 
set names default;
285
262
select cast(-2 as unsigned), 18446744073709551614, -2;
286
263
cast(-2 as unsigned)    18446744073709551614    -2
287
264
18446744073709551614    18446744073709551614    -2
347
324
0       1.500000000000000000000000000000
348
325
select round(1.5, -9223372036854775808), round(1.5, 9223372036854775808);
349
326
round(1.5, -9223372036854775808)        round(1.5, 9223372036854775808)
350
 
0       1.500000000000000000000000000000
 
327
0       2.000000000000000000000000000000
351
328
select truncate(1.5, -9223372036854775808), truncate(1.5, 9223372036854775808);
352
329
truncate(1.5, -9223372036854775808)     truncate(1.5, 9223372036854775808)
353
 
0       1.500000000000000000000000000000
 
330
0       1.000000000000000000000000000000
354
331
select round(1.5, 18446744073709551615), truncate(1.5, 18446744073709551615);
355
332
round(1.5, 18446744073709551615)        truncate(1.5, 18446744073709551615)
356
 
1.500000000000000000000000000000        1.500000000000000000000000000000
 
333
0.000000000000000000000000000000        0.000000000000000000000000000000
357
334
select round(18446744073709551614, -1), truncate(18446744073709551614, -1);
358
335
round(18446744073709551614, -1) truncate(18446744073709551614, -1)
359
336
18446744073709551610    18446744073709551610
369
346
select pow(cast(-2 as unsigned), 5), pow(18446744073709551614, 5), pow(-2, 5);
370
347
pow(cast(-2 as unsigned), 5)    pow(18446744073709551614, 5)    pow(-2, 5)
371
348
2.13598703592091e96     2.13598703592091e96     -32
372
 
CREATE TABLE t1 (a timestamp, b varchar(20), c bit(1));
 
349
CREATE TABLE t1 (a timestamp, b varchar(20), c bit);
373
350
INSERT INTO t1 VALUES('1998-09-23', 'str1', 1), ('2003-03-25', 'str2', 0);
374
351
SELECT a DIV 900 y FROM t1 GROUP BY y;
375
352
y
401
378
0
402
379
0
403
380
DROP TABLE t1;
404
 
CREATE TABLE t1(a SET('a','b','c'));
405
 
INSERT INTO t1 VALUES ('a');
406
 
SELECT a DIV 2 FROM t1 UNION SELECT a DIV 2 FROM t1;
407
 
a DIV 2
408
 
0
409
 
DROP TABLE t1;
410
381
End of 5.0 tests
411
382
SELECT 1e308 + 1e308;
412
383
1e308 + 1e308