~ubuntu-branches/ubuntu/trusty/drizzle/trusty

« back to all changes in this revision

Viewing changes to tests/r/pbxt/type_float.result

  • Committer: Bazaar Package Importer
  • Author(s): Monty Taylor
  • Date: 2010-10-02 14:17:48 UTC
  • mfrom: (1.1.1 upstream)
  • mto: (2.1.17 sid)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20101002141748-m6vbfbfjhrw1153e
Tags: 2010.09.1802-1
* New upstream release.
* Removed pid-file argument hack.
* Updated GPL-2 address to be new address.
* Directly copy in drizzledump.1 since debian doesn't have sphinx 1.0 yet.
* Link to jquery from libjs-jquery. Add it as a depend.
* Add drizzled.8 symlink to the install files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
drop table if exists t1,t2;
 
2
SELECT 10,10.0,10.,.1e+2,100.0e-1;
 
3
10      10.0    10.     .1e+2   100.0e-1
 
4
10      10.0    10      10      10
 
5
SELECT 6e-16, -6e-16, --6e-16, -6e-16+1.000000;
 
6
6e-16   -6e-16  --6e-16 -6e-16+1.000000
 
7
6e-16   -6e-16  6e-16   0.999999999999999
 
8
SELECT 1e1,1.e1,1.0e1,1e+1,1.e+1,1.0e+1,1e-1,1.e-1,1.0e-1;
 
9
1e1     1.e1    1.0e1   1e+1    1.e+1   1.0e+1  1e-1    1.e-1   1.0e-1
 
10
10      10      10      10      10      10      0.1     0.1     0.1
 
11
SELECT 0.001e+1,0.001e-1, -0.001e+01,-0.001e-01;
 
12
0.001e+1        0.001e-1        -0.001e+01      -0.001e-01
 
13
0.01    0.0001  -0.01   -0.0001
 
14
SELECT 123.23E+02,-123.23E-02,"123.23E+02"+0.0,"-123.23E-02"+0.0;
 
15
123.23E+02      -123.23E-02     "123.23E+02"+0.0        "-123.23E-02"+0.0
 
16
12323   -1.2323 12323   -1.2323
 
17
SELECT 2147483647E+02,21474836.47E+06;
 
18
2147483647E+02  21474836.47E+06
 
19
214748364700    21474836470000
 
20
create table t1 (f1 float,f2 float);
 
21
show columns from t1;
 
22
Field   Type    Null    Default Default_is_NULL On_Update
 
23
f1      DOUBLE  YES             YES     
 
24
f2      DOUBLE  YES             YES     
 
25
insert into t1 values(10,10),(1e+5,1e+5),(1234567890,1234567890),(1e+10,1e+10),(1e+15,1e+15),(1e+20,1e+20),(1e+50,1e+50),(1e+150,1e+150);
 
26
insert into t1 values(-10,-10),(1e-5,1e-5),(1e-10,1e-10),(1e-15,1e-15),(1e-20,1e-20),(1e-50,1e-50),(1e-150,1e-150);
 
27
select * from t1;
 
28
f1      f2
 
29
10      10
 
30
100000  100000
 
31
1234567890      1234567890
 
32
10000000000     10000000000
 
33
1e15    1e15
 
34
1e20    1e20
 
35
1e50    1e50
 
36
1e150   1e150
 
37
-10     -10
 
38
0.00001 0.00001
 
39
0.0000000001    0.0000000001
 
40
0.000000000000001       0.000000000000001
 
41
1e-20   1e-20
 
42
1e-50   1e-50
 
43
1e-150  1e-150
 
44
drop table t1;
 
45
create table t1 (datum double);
 
46
insert into t1 values (0.5),(1.0),(1.5),(2.0),(2.5);
 
47
select * from t1;
 
48
datum
 
49
0.5
 
50
1
 
51
1.5
 
52
2
 
53
2.5
 
54
select * from t1 where datum < 1.5;
 
55
datum
 
56
0.5
 
57
1
 
58
select * from t1 where datum > 1.5;
 
59
datum
 
60
2
 
61
2.5
 
62
select * from t1 where datum = 1.5;
 
63
datum
 
64
1.5
 
65
drop table t1;
 
66
create table t1 (a  decimal(7,3) not null, key (a));
 
67
insert into t1 values ("0"),("-0.00"),("-0.01"),("-0.002"),("1");
 
68
select a from t1 order by a;
 
69
a
 
70
-0.010
 
71
-0.002
 
72
0.000
 
73
0.000
 
74
1.000
 
75
select min(a) from t1;
 
76
min(a)
 
77
-0.010
 
78
drop table t1;
 
79
create table t1 (c1 double, c2 varchar(20));
 
80
insert t1 values (121,"16");
 
81
select c1 + c1 * (c2 / 100) as col from t1;
 
82
col
 
83
140.36
 
84
create table t2 select c1 + c1 * (c2 / 100) as col1, round(c1, 5) as col2, round(c1, 35) as col3, sqrt(c1*1e-15) col4 from t1;
 
85
select * from t2;
 
86
col1    col2    col3    col4
 
87
140.36  121.00000       121     0.000000347850542618522
 
88
show create table t2;
 
89
Table   Create Table
 
90
t2      CREATE TABLE `t2` (
 
91
  `col1` DOUBLE DEFAULT NULL,
 
92
  `col2` DOUBLE(22,5) DEFAULT NULL,
 
93
  `col3` DOUBLE DEFAULT NULL,
 
94
  `col4` DOUBLE DEFAULT NULL
 
95
) ENGINE=DEFAULT COLLATE = utf8_general_ci
 
96
drop table t1,t2;
 
97
create table t1 (a float);
 
98
insert into t1 values (1);
 
99
select max(a),min(a),avg(a) from t1;
 
100
max(a)  min(a)  avg(a)
 
101
1       1       1
 
102
drop table t1;
 
103
create table t1 (f float, f2 float, f3 float, d double, d2 float, d3 double, de decimal, de2 decimal(6), de3 decimal(5,2), n numeric, n2 numeric(8), n3 numeric(7,6));
 
104
show columns from t1;
 
105
Field   Type    Null    Default Default_is_NULL On_Update
 
106
f       DOUBLE  YES             YES     
 
107
f2      DOUBLE  YES             YES     
 
108
f3      DOUBLE  YES             YES     
 
109
d       DOUBLE  YES             YES     
 
110
d2      DOUBLE  YES             YES     
 
111
d3      DOUBLE  YES             YES     
 
112
de      DECIMAL YES             YES     
 
113
de2     DECIMAL YES             YES     
 
114
de3     DECIMAL YES             YES     
 
115
n       DECIMAL YES             YES     
 
116
n2      DECIMAL YES             YES     
 
117
n3      DECIMAL YES             YES     
 
118
drop table t1;
 
119
create table t1 (a  decimal(7,3) not null, key (a));
 
120
insert into t1 values ("0"),("-0.00"),("-0.01"),("-0.002"),("1");
 
121
select a from t1 order by a;
 
122
a
 
123
-0.010
 
124
-0.002
 
125
0.000
 
126
0.000
 
127
1.000
 
128
select min(a) from t1;
 
129
min(a)
 
130
-0.010
 
131
drop table t1;
 
132
create table t1 (c20 char);
 
133
insert into t1 values (5000.0);
 
134
ERROR 22001: Data too long for column 'c20' at row 1
 
135
insert into t1 values (0.5e4);
 
136
ERROR 22001: Data too long for column 'c20' at row 1
 
137
drop table t1;
 
138
create table t1 (d1 double, d2 double);
 
139
insert into t1 set d1 = -1.0;
 
140
update t1 set d2 = d1;
 
141
select * from t1;
 
142
d1      d2
 
143
-1      -1
 
144
drop table t1;
 
145
create table t1 (f float(4,3));
 
146
insert into t1 values (-11.0),(-11),("-11"),(11.0),(11),("11");
 
147
ERROR 22003: Out of range value for column 'f' at row 1
 
148
select * from t1;
 
149
f
 
150
drop table if exists t1;
 
151
create table t1 (f double(4,3));
 
152
insert into t1 values (-11.0),(-11),("-11"),(11.0),(11),("11");
 
153
ERROR 22003: Out of range value for column 'f' at row 1
 
154
select * from t1;
 
155
f
 
156
drop table if exists t1;
 
157
create table t1 (c char(20));
 
158
insert into t1 values (5e-28);
 
159
select * from t1;
 
160
c
 
161
5e-28
 
162
drop table t1;
 
163
create table t1 (c char(6));
 
164
insert into t1 values (2e5),(2e6),(2e-4),(2e-5);
 
165
select * from t1;
 
166
c
 
167
200000
 
168
2e6
 
169
0.0002
 
170
2e-5
 
171
drop table t1;
 
172
CREATE TEMPORARY TABLE t1 (
 
173
reckey int NOT NULL,
 
174
recdesc varchar(50) NOT NULL,
 
175
PRIMARY KEY  (reckey)
 
176
) ENGINE=MyISAM;
 
177
INSERT INTO t1 VALUES (108, 'Has 108 as key');
 
178
INSERT INTO t1 VALUES (109, 'Has 109 as key');
 
179
select * from t1 where reckey=108;
 
180
reckey  recdesc
 
181
108     Has 108 as key
 
182
select * from t1 where reckey=1.08E2;
 
183
reckey  recdesc
 
184
108     Has 108 as key
 
185
select * from t1 where reckey=109;
 
186
reckey  recdesc
 
187
109     Has 109 as key
 
188
select * from t1 where reckey=1.09E2;
 
189
reckey  recdesc
 
190
109     Has 109 as key
 
191
drop table t1;
 
192
create table t1 (d double);
 
193
create table t2 (d double);
 
194
insert into t1 values ("100000000.0");
 
195
insert into t2 values ("1.23456780");
 
196
create table t3 select * from t2 union select * from t1;
 
197
select * from t3;
 
198
d
 
199
1.2345678
 
200
100000000
 
201
show create table t3;
 
202
Table   Create Table
 
203
t3      CREATE TABLE `t3` (
 
204
  `d` DOUBLE DEFAULT NULL
 
205
) ENGINE=DEFAULT COLLATE = utf8_general_ci
 
206
drop table t1, t2, t3;
 
207
create table t1 select  105213674794682365.00 + 0.0 x;
 
208
show warnings;
 
209
Level   Code    Message
 
210
desc  t1;
 
211
Field   Type    Null    Default Default_is_NULL On_Update
 
212
x       DECIMAL NO              NO      
 
213
drop table t1;
 
214
create table t1 select 0.0 x;
 
215
desc t1;
 
216
Field   Type    Null    Default Default_is_NULL On_Update
 
217
x       DECIMAL NO              NO      
 
218
create table t2 select 105213674794682365.00 y;
 
219
desc t2;
 
220
Field   Type    Null    Default Default_is_NULL On_Update
 
221
y       DECIMAL NO              NO      
 
222
create table t3 select x+y a from t1,t2;
 
223
show warnings;
 
224
Level   Code    Message
 
225
desc t3;
 
226
Field   Type    Null    Default Default_is_NULL On_Update
 
227
a       DECIMAL NO              NO      
 
228
drop table t1,t2,t3;
 
229
select 1e-308, 1.00000001e-300, 100000000e-300;
 
230
1e-308  1.00000001e-300 100000000e-300
 
231
1e-308  1.00000001e-300 1e-292
 
232
select 10e307;
 
233
10e307
 
234
1e308
 
235
create table t1(a int, b double(8, 2));
 
236
insert into t1 values
 
237
(1, 28.50), (1, 121.85), (1, 157.23), (1, 1351.00), (1, -1965.35), (1, 81.75), 
 
238
(1, 217.08), (1, 7.94), (4, 96.07), (4, 6404.65), (4, -6500.72), (2, 100.00),
 
239
(5, 5.00), (5, -2104.80), (5, 2033.80), (5, 0.07), (5, 65.93),
 
240
(3, -4986.24), (3, 5.00), (3, 4857.34), (3, 123.74), (3,  0.16),
 
241
(6, -1695.31), (6, 1003.77), (6, 499.72), (6, 191.82);
 
242
explain select sum(b) s from t1 group by a;
 
243
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
 
244
1       SIMPLE  t1      ALL     NULL    NULL    NULL    NULL    26      Using temporary; Using filesort
 
245
select sum(b) s from t1 group by a;
 
246
s
 
247
0.00
 
248
100.00
 
249
0.00
 
250
-0.00
 
251
-0.00
 
252
0.00
 
253
select sum(b) s from t1 group by a having s <> 0;
 
254
s
 
255
100.00
 
256
select sum(b) s from t1 group by a having s <> 0 order by s;
 
257
s
 
258
100.00
 
259
select sum(b) s from t1 group by a having s <=> 0;
 
260
s
 
261
0.00
 
262
0.00
 
263
-0.00
 
264
-0.00
 
265
0.00
 
266
select sum(b) s from t1 group by a having s <=> 0 order by s;
 
267
s
 
268
-0.00
 
269
-0.00
 
270
0.00
 
271
0.00
 
272
0.00
 
273
alter table t1 add key (a, b);
 
274
explain select sum(b) s from t1 group by a;
 
275
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
 
276
1       SIMPLE  t1      ALL     NULL    NULL    NULL    NULL    26      Using temporary; Using filesort
 
277
select sum(b) s from t1 group by a;
 
278
s
 
279
0.00
 
280
100.00
 
281
0.00
 
282
-0.00
 
283
-0.00
 
284
0.00
 
285
select sum(b) s from t1 group by a having s <> 0;
 
286
s
 
287
100.00
 
288
select sum(b) s from t1 group by a having s <> 0 order by s;
 
289
s
 
290
100.00
 
291
select sum(b) s from t1 group by a having s <=> 0;
 
292
s
 
293
0.00
 
294
0.00
 
295
-0.00
 
296
-0.00
 
297
0.00
 
298
select sum(b) s from t1 group by a having s <=> 0 order by s;
 
299
s
 
300
-0.00
 
301
-0.00
 
302
0.00
 
303
0.00
 
304
0.00
 
305
drop table t1;
 
306
End of 4.1 tests
 
307
create table t1 (s1 float(0,2));
 
308
ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column 's1').
 
309
create table t1 (s1 float(1,2));
 
310
ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column 's1').
 
311
create table t1 (f1 double(200, 0));
 
312
insert into t1 values (1e199), (-1e199);
 
313
insert into t1 values (1e200), (-1e200);
 
314
insert into t1 values (2e200), (-2e200);
 
315
ERROR 22003: Out of range value for column 'f1' at row 1
 
316
select f1 + 0e0 from t1;
 
317
f1 + 0e0
 
318
1e199
 
319
-1e199
 
320
1e200
 
321
-1e200
 
322
drop table t1;
 
323
create table t1 (f1 float(30, 0));
 
324
insert into t1 values (1e29), (-1e29);
 
325
insert into t1 values (1e30), (-1e30);
 
326
insert into t1 values (2e30), (-2e30);
 
327
ERROR 22003: Out of range value for column 'f1' at row 1
 
328
select f1 + 0e0 from t1;
 
329
f1 + 0e0
 
330
1e29
 
331
-1e29
 
332
1e30
 
333
-1e30
 
334
drop table t1;
 
335
create table t1 (c char(6));
 
336
insert into t1 values (2e6),(2e-5);
 
337
select * from t1;
 
338
c
 
339
2e6
 
340
2e-5
 
341
drop table t1;
 
342
CREATE TABLE d1 (d DOUBLE);
 
343
INSERT INTO d1 VALUES (1.7976931348623157E+308);
 
344
SELECT * FROM d1;
 
345
d
 
346
1.79769313486232e308
 
347
INSERT INTO d1 VALUES (1.79769313486232e+308);
 
348
ERROR 22007: Illegal double '1.79769313486232e+308' value found during parsing
 
349
SELECT * FROM d1;
 
350
d
 
351
1.79769313486232e308
 
352
DROP TABLE d1;
 
353
create table t1 (a char(20));
 
354
insert into t1 values (1.225e-05);
 
355
select a+0 from t1;
 
356
a+0
 
357
0.00001225
 
358
drop table t1;
 
359
End of 5.0 tests