1--TEST--
2Test - operator : 64bit long tests
3--SKIPIF--
4<?php
5if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
6?>
7--FILE--
8<?php
9
10define("MAX_64Bit", 9223372036854775807);
11define("MAX_32Bit", 2147483647);
12define("MIN_64Bit", -9223372036854775807 - 1);
13define("MIN_32Bit", -2147483647 - 1);
14
15$longVals = array(
16    MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
17    MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
18    MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
19);
20
21$otherVals = array(0, 1, -1, 7, 9, 65, -44, MAX_32Bit, MAX_64Bit);
22
23error_reporting(E_ERROR);
24
25foreach ($longVals as $longVal) {
26   foreach($otherVals as $otherVal) {
27       echo "--- testing: $longVal - $otherVal ---\n";
28      var_dump($longVal-$otherVal);
29   }
30}
31
32foreach ($otherVals as $otherVal) {
33   foreach($longVals as $longVal) {
34       echo "--- testing: $otherVal - $longVal ---\n";
35      var_dump($otherVal-$longVal);
36   }
37}
38
39?>
40--EXPECT--
41--- testing: 9223372036854775807 - 0 ---
42int(9223372036854775807)
43--- testing: 9223372036854775807 - 1 ---
44int(9223372036854775806)
45--- testing: 9223372036854775807 - -1 ---
46float(9.223372036854776E+18)
47--- testing: 9223372036854775807 - 7 ---
48int(9223372036854775800)
49--- testing: 9223372036854775807 - 9 ---
50int(9223372036854775798)
51--- testing: 9223372036854775807 - 65 ---
52int(9223372036854775742)
53--- testing: 9223372036854775807 - -44 ---
54float(9.223372036854776E+18)
55--- testing: 9223372036854775807 - 2147483647 ---
56int(9223372034707292160)
57--- testing: 9223372036854775807 - 9223372036854775807 ---
58int(0)
59--- testing: -9223372036854775808 - 0 ---
60int(-9223372036854775808)
61--- testing: -9223372036854775808 - 1 ---
62float(-9.223372036854776E+18)
63--- testing: -9223372036854775808 - -1 ---
64int(-9223372036854775807)
65--- testing: -9223372036854775808 - 7 ---
66float(-9.223372036854776E+18)
67--- testing: -9223372036854775808 - 9 ---
68float(-9.223372036854776E+18)
69--- testing: -9223372036854775808 - 65 ---
70float(-9.223372036854776E+18)
71--- testing: -9223372036854775808 - -44 ---
72int(-9223372036854775764)
73--- testing: -9223372036854775808 - 2147483647 ---
74float(-9.22337203900226E+18)
75--- testing: -9223372036854775808 - 9223372036854775807 ---
76float(-1.8446744073709552E+19)
77--- testing: 2147483647 - 0 ---
78int(2147483647)
79--- testing: 2147483647 - 1 ---
80int(2147483646)
81--- testing: 2147483647 - -1 ---
82int(2147483648)
83--- testing: 2147483647 - 7 ---
84int(2147483640)
85--- testing: 2147483647 - 9 ---
86int(2147483638)
87--- testing: 2147483647 - 65 ---
88int(2147483582)
89--- testing: 2147483647 - -44 ---
90int(2147483691)
91--- testing: 2147483647 - 2147483647 ---
92int(0)
93--- testing: 2147483647 - 9223372036854775807 ---
94int(-9223372034707292160)
95--- testing: -2147483648 - 0 ---
96int(-2147483648)
97--- testing: -2147483648 - 1 ---
98int(-2147483649)
99--- testing: -2147483648 - -1 ---
100int(-2147483647)
101--- testing: -2147483648 - 7 ---
102int(-2147483655)
103--- testing: -2147483648 - 9 ---
104int(-2147483657)
105--- testing: -2147483648 - 65 ---
106int(-2147483713)
107--- testing: -2147483648 - -44 ---
108int(-2147483604)
109--- testing: -2147483648 - 2147483647 ---
110int(-4294967295)
111--- testing: -2147483648 - 9223372036854775807 ---
112float(-9.22337203900226E+18)
113--- testing: 9223372034707292160 - 0 ---
114int(9223372034707292160)
115--- testing: 9223372034707292160 - 1 ---
116int(9223372034707292159)
117--- testing: 9223372034707292160 - -1 ---
118int(9223372034707292161)
119--- testing: 9223372034707292160 - 7 ---
120int(9223372034707292153)
121--- testing: 9223372034707292160 - 9 ---
122int(9223372034707292151)
123--- testing: 9223372034707292160 - 65 ---
124int(9223372034707292095)
125--- testing: 9223372034707292160 - -44 ---
126int(9223372034707292204)
127--- testing: 9223372034707292160 - 2147483647 ---
128int(9223372032559808513)
129--- testing: 9223372034707292160 - 9223372036854775807 ---
130int(-2147483647)
131--- testing: -9223372034707292160 - 0 ---
132int(-9223372034707292160)
133--- testing: -9223372034707292160 - 1 ---
134int(-9223372034707292161)
135--- testing: -9223372034707292160 - -1 ---
136int(-9223372034707292159)
137--- testing: -9223372034707292160 - 7 ---
138int(-9223372034707292167)
139--- testing: -9223372034707292160 - 9 ---
140int(-9223372034707292169)
141--- testing: -9223372034707292160 - 65 ---
142int(-9223372034707292225)
143--- testing: -9223372034707292160 - -44 ---
144int(-9223372034707292116)
145--- testing: -9223372034707292160 - 2147483647 ---
146int(-9223372036854775807)
147--- testing: -9223372034707292160 - 9223372036854775807 ---
148float(-1.8446744071562068E+19)
149--- testing: 2147483648 - 0 ---
150int(2147483648)
151--- testing: 2147483648 - 1 ---
152int(2147483647)
153--- testing: 2147483648 - -1 ---
154int(2147483649)
155--- testing: 2147483648 - 7 ---
156int(2147483641)
157--- testing: 2147483648 - 9 ---
158int(2147483639)
159--- testing: 2147483648 - 65 ---
160int(2147483583)
161--- testing: 2147483648 - -44 ---
162int(2147483692)
163--- testing: 2147483648 - 2147483647 ---
164int(1)
165--- testing: 2147483648 - 9223372036854775807 ---
166int(-9223372034707292159)
167--- testing: -2147483649 - 0 ---
168int(-2147483649)
169--- testing: -2147483649 - 1 ---
170int(-2147483650)
171--- testing: -2147483649 - -1 ---
172int(-2147483648)
173--- testing: -2147483649 - 7 ---
174int(-2147483656)
175--- testing: -2147483649 - 9 ---
176int(-2147483658)
177--- testing: -2147483649 - 65 ---
178int(-2147483714)
179--- testing: -2147483649 - -44 ---
180int(-2147483605)
181--- testing: -2147483649 - 2147483647 ---
182int(-4294967296)
183--- testing: -2147483649 - 9223372036854775807 ---
184float(-9.22337203900226E+18)
185--- testing: 4294967294 - 0 ---
186int(4294967294)
187--- testing: 4294967294 - 1 ---
188int(4294967293)
189--- testing: 4294967294 - -1 ---
190int(4294967295)
191--- testing: 4294967294 - 7 ---
192int(4294967287)
193--- testing: 4294967294 - 9 ---
194int(4294967285)
195--- testing: 4294967294 - 65 ---
196int(4294967229)
197--- testing: 4294967294 - -44 ---
198int(4294967338)
199--- testing: 4294967294 - 2147483647 ---
200int(2147483647)
201--- testing: 4294967294 - 9223372036854775807 ---
202int(-9223372032559808513)
203--- testing: 4294967295 - 0 ---
204int(4294967295)
205--- testing: 4294967295 - 1 ---
206int(4294967294)
207--- testing: 4294967295 - -1 ---
208int(4294967296)
209--- testing: 4294967295 - 7 ---
210int(4294967288)
211--- testing: 4294967295 - 9 ---
212int(4294967286)
213--- testing: 4294967295 - 65 ---
214int(4294967230)
215--- testing: 4294967295 - -44 ---
216int(4294967339)
217--- testing: 4294967295 - 2147483647 ---
218int(2147483648)
219--- testing: 4294967295 - 9223372036854775807 ---
220int(-9223372032559808512)
221--- testing: 4294967293 - 0 ---
222int(4294967293)
223--- testing: 4294967293 - 1 ---
224int(4294967292)
225--- testing: 4294967293 - -1 ---
226int(4294967294)
227--- testing: 4294967293 - 7 ---
228int(4294967286)
229--- testing: 4294967293 - 9 ---
230int(4294967284)
231--- testing: 4294967293 - 65 ---
232int(4294967228)
233--- testing: 4294967293 - -44 ---
234int(4294967337)
235--- testing: 4294967293 - 2147483647 ---
236int(2147483646)
237--- testing: 4294967293 - 9223372036854775807 ---
238int(-9223372032559808514)
239--- testing: 9223372036854775806 - 0 ---
240int(9223372036854775806)
241--- testing: 9223372036854775806 - 1 ---
242int(9223372036854775805)
243--- testing: 9223372036854775806 - -1 ---
244int(9223372036854775807)
245--- testing: 9223372036854775806 - 7 ---
246int(9223372036854775799)
247--- testing: 9223372036854775806 - 9 ---
248int(9223372036854775797)
249--- testing: 9223372036854775806 - 65 ---
250int(9223372036854775741)
251--- testing: 9223372036854775806 - -44 ---
252float(9.223372036854776E+18)
253--- testing: 9223372036854775806 - 2147483647 ---
254int(9223372034707292159)
255--- testing: 9223372036854775806 - 9223372036854775807 ---
256int(-1)
257--- testing: 9.2233720368548E+18 - 0 ---
258float(9.223372036854776E+18)
259--- testing: 9.2233720368548E+18 - 1 ---
260float(9.223372036854776E+18)
261--- testing: 9.2233720368548E+18 - -1 ---
262float(9.223372036854776E+18)
263--- testing: 9.2233720368548E+18 - 7 ---
264float(9.223372036854776E+18)
265--- testing: 9.2233720368548E+18 - 9 ---
266float(9.223372036854776E+18)
267--- testing: 9.2233720368548E+18 - 65 ---
268float(9.223372036854776E+18)
269--- testing: 9.2233720368548E+18 - -44 ---
270float(9.223372036854776E+18)
271--- testing: 9.2233720368548E+18 - 2147483647 ---
272float(9.223372034707292E+18)
273--- testing: 9.2233720368548E+18 - 9223372036854775807 ---
274float(0)
275--- testing: -9223372036854775807 - 0 ---
276int(-9223372036854775807)
277--- testing: -9223372036854775807 - 1 ---
278int(-9223372036854775808)
279--- testing: -9223372036854775807 - -1 ---
280int(-9223372036854775806)
281--- testing: -9223372036854775807 - 7 ---
282float(-9.223372036854776E+18)
283--- testing: -9223372036854775807 - 9 ---
284float(-9.223372036854776E+18)
285--- testing: -9223372036854775807 - 65 ---
286float(-9.223372036854776E+18)
287--- testing: -9223372036854775807 - -44 ---
288int(-9223372036854775763)
289--- testing: -9223372036854775807 - 2147483647 ---
290float(-9.22337203900226E+18)
291--- testing: -9223372036854775807 - 9223372036854775807 ---
292float(-1.8446744073709552E+19)
293--- testing: -9.2233720368548E+18 - 0 ---
294float(-9.223372036854776E+18)
295--- testing: -9.2233720368548E+18 - 1 ---
296float(-9.223372036854776E+18)
297--- testing: -9.2233720368548E+18 - -1 ---
298float(-9.223372036854776E+18)
299--- testing: -9.2233720368548E+18 - 7 ---
300float(-9.223372036854776E+18)
301--- testing: -9.2233720368548E+18 - 9 ---
302float(-9.223372036854776E+18)
303--- testing: -9.2233720368548E+18 - 65 ---
304float(-9.223372036854776E+18)
305--- testing: -9.2233720368548E+18 - -44 ---
306float(-9.223372036854776E+18)
307--- testing: -9.2233720368548E+18 - 2147483647 ---
308float(-9.22337203900226E+18)
309--- testing: -9.2233720368548E+18 - 9223372036854775807 ---
310float(-1.8446744073709552E+19)
311--- testing: 0 - 9223372036854775807 ---
312int(-9223372036854775807)
313--- testing: 0 - -9223372036854775808 ---
314float(9.223372036854776E+18)
315--- testing: 0 - 2147483647 ---
316int(-2147483647)
317--- testing: 0 - -2147483648 ---
318int(2147483648)
319--- testing: 0 - 9223372034707292160 ---
320int(-9223372034707292160)
321--- testing: 0 - -9223372034707292160 ---
322int(9223372034707292160)
323--- testing: 0 - 2147483648 ---
324int(-2147483648)
325--- testing: 0 - -2147483649 ---
326int(2147483649)
327--- testing: 0 - 4294967294 ---
328int(-4294967294)
329--- testing: 0 - 4294967295 ---
330int(-4294967295)
331--- testing: 0 - 4294967293 ---
332int(-4294967293)
333--- testing: 0 - 9223372036854775806 ---
334int(-9223372036854775806)
335--- testing: 0 - 9.2233720368548E+18 ---
336float(-9.223372036854776E+18)
337--- testing: 0 - -9223372036854775807 ---
338int(9223372036854775807)
339--- testing: 0 - -9.2233720368548E+18 ---
340float(9.223372036854776E+18)
341--- testing: 1 - 9223372036854775807 ---
342int(-9223372036854775806)
343--- testing: 1 - -9223372036854775808 ---
344float(9.223372036854776E+18)
345--- testing: 1 - 2147483647 ---
346int(-2147483646)
347--- testing: 1 - -2147483648 ---
348int(2147483649)
349--- testing: 1 - 9223372034707292160 ---
350int(-9223372034707292159)
351--- testing: 1 - -9223372034707292160 ---
352int(9223372034707292161)
353--- testing: 1 - 2147483648 ---
354int(-2147483647)
355--- testing: 1 - -2147483649 ---
356int(2147483650)
357--- testing: 1 - 4294967294 ---
358int(-4294967293)
359--- testing: 1 - 4294967295 ---
360int(-4294967294)
361--- testing: 1 - 4294967293 ---
362int(-4294967292)
363--- testing: 1 - 9223372036854775806 ---
364int(-9223372036854775805)
365--- testing: 1 - 9.2233720368548E+18 ---
366float(-9.223372036854776E+18)
367--- testing: 1 - -9223372036854775807 ---
368float(9.223372036854776E+18)
369--- testing: 1 - -9.2233720368548E+18 ---
370float(9.223372036854776E+18)
371--- testing: -1 - 9223372036854775807 ---
372int(-9223372036854775808)
373--- testing: -1 - -9223372036854775808 ---
374int(9223372036854775807)
375--- testing: -1 - 2147483647 ---
376int(-2147483648)
377--- testing: -1 - -2147483648 ---
378int(2147483647)
379--- testing: -1 - 9223372034707292160 ---
380int(-9223372034707292161)
381--- testing: -1 - -9223372034707292160 ---
382int(9223372034707292159)
383--- testing: -1 - 2147483648 ---
384int(-2147483649)
385--- testing: -1 - -2147483649 ---
386int(2147483648)
387--- testing: -1 - 4294967294 ---
388int(-4294967295)
389--- testing: -1 - 4294967295 ---
390int(-4294967296)
391--- testing: -1 - 4294967293 ---
392int(-4294967294)
393--- testing: -1 - 9223372036854775806 ---
394int(-9223372036854775807)
395--- testing: -1 - 9.2233720368548E+18 ---
396float(-9.223372036854776E+18)
397--- testing: -1 - -9223372036854775807 ---
398int(9223372036854775806)
399--- testing: -1 - -9.2233720368548E+18 ---
400float(9.223372036854776E+18)
401--- testing: 7 - 9223372036854775807 ---
402int(-9223372036854775800)
403--- testing: 7 - -9223372036854775808 ---
404float(9.223372036854776E+18)
405--- testing: 7 - 2147483647 ---
406int(-2147483640)
407--- testing: 7 - -2147483648 ---
408int(2147483655)
409--- testing: 7 - 9223372034707292160 ---
410int(-9223372034707292153)
411--- testing: 7 - -9223372034707292160 ---
412int(9223372034707292167)
413--- testing: 7 - 2147483648 ---
414int(-2147483641)
415--- testing: 7 - -2147483649 ---
416int(2147483656)
417--- testing: 7 - 4294967294 ---
418int(-4294967287)
419--- testing: 7 - 4294967295 ---
420int(-4294967288)
421--- testing: 7 - 4294967293 ---
422int(-4294967286)
423--- testing: 7 - 9223372036854775806 ---
424int(-9223372036854775799)
425--- testing: 7 - 9.2233720368548E+18 ---
426float(-9.223372036854776E+18)
427--- testing: 7 - -9223372036854775807 ---
428float(9.223372036854776E+18)
429--- testing: 7 - -9.2233720368548E+18 ---
430float(9.223372036854776E+18)
431--- testing: 9 - 9223372036854775807 ---
432int(-9223372036854775798)
433--- testing: 9 - -9223372036854775808 ---
434float(9.223372036854776E+18)
435--- testing: 9 - 2147483647 ---
436int(-2147483638)
437--- testing: 9 - -2147483648 ---
438int(2147483657)
439--- testing: 9 - 9223372034707292160 ---
440int(-9223372034707292151)
441--- testing: 9 - -9223372034707292160 ---
442int(9223372034707292169)
443--- testing: 9 - 2147483648 ---
444int(-2147483639)
445--- testing: 9 - -2147483649 ---
446int(2147483658)
447--- testing: 9 - 4294967294 ---
448int(-4294967285)
449--- testing: 9 - 4294967295 ---
450int(-4294967286)
451--- testing: 9 - 4294967293 ---
452int(-4294967284)
453--- testing: 9 - 9223372036854775806 ---
454int(-9223372036854775797)
455--- testing: 9 - 9.2233720368548E+18 ---
456float(-9.223372036854776E+18)
457--- testing: 9 - -9223372036854775807 ---
458float(9.223372036854776E+18)
459--- testing: 9 - -9.2233720368548E+18 ---
460float(9.223372036854776E+18)
461--- testing: 65 - 9223372036854775807 ---
462int(-9223372036854775742)
463--- testing: 65 - -9223372036854775808 ---
464float(9.223372036854776E+18)
465--- testing: 65 - 2147483647 ---
466int(-2147483582)
467--- testing: 65 - -2147483648 ---
468int(2147483713)
469--- testing: 65 - 9223372034707292160 ---
470int(-9223372034707292095)
471--- testing: 65 - -9223372034707292160 ---
472int(9223372034707292225)
473--- testing: 65 - 2147483648 ---
474int(-2147483583)
475--- testing: 65 - -2147483649 ---
476int(2147483714)
477--- testing: 65 - 4294967294 ---
478int(-4294967229)
479--- testing: 65 - 4294967295 ---
480int(-4294967230)
481--- testing: 65 - 4294967293 ---
482int(-4294967228)
483--- testing: 65 - 9223372036854775806 ---
484int(-9223372036854775741)
485--- testing: 65 - 9.2233720368548E+18 ---
486float(-9.223372036854776E+18)
487--- testing: 65 - -9223372036854775807 ---
488float(9.223372036854776E+18)
489--- testing: 65 - -9.2233720368548E+18 ---
490float(9.223372036854776E+18)
491--- testing: -44 - 9223372036854775807 ---
492float(-9.223372036854776E+18)
493--- testing: -44 - -9223372036854775808 ---
494int(9223372036854775764)
495--- testing: -44 - 2147483647 ---
496int(-2147483691)
497--- testing: -44 - -2147483648 ---
498int(2147483604)
499--- testing: -44 - 9223372034707292160 ---
500int(-9223372034707292204)
501--- testing: -44 - -9223372034707292160 ---
502int(9223372034707292116)
503--- testing: -44 - 2147483648 ---
504int(-2147483692)
505--- testing: -44 - -2147483649 ---
506int(2147483605)
507--- testing: -44 - 4294967294 ---
508int(-4294967338)
509--- testing: -44 - 4294967295 ---
510int(-4294967339)
511--- testing: -44 - 4294967293 ---
512int(-4294967337)
513--- testing: -44 - 9223372036854775806 ---
514float(-9.223372036854776E+18)
515--- testing: -44 - 9.2233720368548E+18 ---
516float(-9.223372036854776E+18)
517--- testing: -44 - -9223372036854775807 ---
518int(9223372036854775763)
519--- testing: -44 - -9.2233720368548E+18 ---
520float(9.223372036854776E+18)
521--- testing: 2147483647 - 9223372036854775807 ---
522int(-9223372034707292160)
523--- testing: 2147483647 - -9223372036854775808 ---
524float(9.22337203900226E+18)
525--- testing: 2147483647 - 2147483647 ---
526int(0)
527--- testing: 2147483647 - -2147483648 ---
528int(4294967295)
529--- testing: 2147483647 - 9223372034707292160 ---
530int(-9223372032559808513)
531--- testing: 2147483647 - -9223372034707292160 ---
532int(9223372036854775807)
533--- testing: 2147483647 - 2147483648 ---
534int(-1)
535--- testing: 2147483647 - -2147483649 ---
536int(4294967296)
537--- testing: 2147483647 - 4294967294 ---
538int(-2147483647)
539--- testing: 2147483647 - 4294967295 ---
540int(-2147483648)
541--- testing: 2147483647 - 4294967293 ---
542int(-2147483646)
543--- testing: 2147483647 - 9223372036854775806 ---
544int(-9223372034707292159)
545--- testing: 2147483647 - 9.2233720368548E+18 ---
546float(-9.223372034707292E+18)
547--- testing: 2147483647 - -9223372036854775807 ---
548float(9.22337203900226E+18)
549--- testing: 2147483647 - -9.2233720368548E+18 ---
550float(9.22337203900226E+18)
551--- testing: 9223372036854775807 - 9223372036854775807 ---
552int(0)
553--- testing: 9223372036854775807 - -9223372036854775808 ---
554float(1.8446744073709552E+19)
555--- testing: 9223372036854775807 - 2147483647 ---
556int(9223372034707292160)
557--- testing: 9223372036854775807 - -2147483648 ---
558float(9.22337203900226E+18)
559--- testing: 9223372036854775807 - 9223372034707292160 ---
560int(2147483647)
561--- testing: 9223372036854775807 - -9223372034707292160 ---
562float(1.8446744071562068E+19)
563--- testing: 9223372036854775807 - 2147483648 ---
564int(9223372034707292159)
565--- testing: 9223372036854775807 - -2147483649 ---
566float(9.22337203900226E+18)
567--- testing: 9223372036854775807 - 4294967294 ---
568int(9223372032559808513)
569--- testing: 9223372036854775807 - 4294967295 ---
570int(9223372032559808512)
571--- testing: 9223372036854775807 - 4294967293 ---
572int(9223372032559808514)
573--- testing: 9223372036854775807 - 9223372036854775806 ---
574int(1)
575--- testing: 9223372036854775807 - 9.2233720368548E+18 ---
576float(0)
577--- testing: 9223372036854775807 - -9223372036854775807 ---
578float(1.8446744073709552E+19)
579--- testing: 9223372036854775807 - -9.2233720368548E+18 ---
580float(1.8446744073709552E+19)
581