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===DONE===
41--EXPECT--
42--- testing: 9223372036854775807 / 0 ---
43bool(false)
44--- testing: 9223372036854775807 / 1 ---
45int(9223372036854775807)
46--- testing: 9223372036854775807 / -1 ---
47int(-9223372036854775807)
48--- testing: 9223372036854775807 / 7 ---
49int(1317624576693539401)
50--- testing: 9223372036854775807 / 9 ---
51float(1.0248191152061E+18)
52--- testing: 9223372036854775807 / 65 ---
53float(1.4189803133623E+17)
54--- testing: 9223372036854775807 / -44 ---
55float(-2.096220917467E+17)
56--- testing: 9223372036854775807 / 2147483647 ---
57float(4294967298)
58--- testing: 9223372036854775807 / 9223372036854775807 ---
59int(1)
60--- testing: -9223372036854775808 / 0 ---
61bool(false)
62--- testing: -9223372036854775808 / 1 ---
63int(-9223372036854775808)
64--- testing: -9223372036854775808 / -1 ---
65float(9.2233720368548E+18)
66--- testing: -9223372036854775808 / 7 ---
67float(-1.3176245766935E+18)
68--- testing: -9223372036854775808 / 9 ---
69float(-1.0248191152061E+18)
70--- testing: -9223372036854775808 / 65 ---
71float(-1.4189803133623E+17)
72--- testing: -9223372036854775808 / -44 ---
73float(2.096220917467E+17)
74--- testing: -9223372036854775808 / 2147483647 ---
75float(-4294967298)
76--- testing: -9223372036854775808 / 9223372036854775807 ---
77float(-1)
78--- testing: 2147483647 / 0 ---
79bool(false)
80--- testing: 2147483647 / 1 ---
81int(2147483647)
82--- testing: 2147483647 / -1 ---
83int(-2147483647)
84--- testing: 2147483647 / 7 ---
85float(306783378.14286)
86--- testing: 2147483647 / 9 ---
87float(238609294.11111)
88--- testing: 2147483647 / 65 ---
89float(33038209.953846)
90--- testing: 2147483647 / -44 ---
91float(-48806446.522727)
92--- testing: 2147483647 / 2147483647 ---
93int(1)
94--- testing: 2147483647 / 9223372036854775807 ---
95float(2.3283064354545E-10)
96--- testing: -2147483648 / 0 ---
97bool(false)
98--- testing: -2147483648 / 1 ---
99int(-2147483648)
100--- testing: -2147483648 / -1 ---
101int(2147483648)
102--- testing: -2147483648 / 7 ---
103float(-306783378.28571)
104--- testing: -2147483648 / 9 ---
105float(-238609294.22222)
106--- testing: -2147483648 / 65 ---
107float(-33038209.969231)
108--- testing: -2147483648 / -44 ---
109float(48806446.545455)
110--- testing: -2147483648 / 2147483647 ---
111float(-1.0000000004657)
112--- testing: -2147483648 / 9223372036854775807 ---
113float(-2.3283064365387E-10)
114--- testing: 9223372034707292160 / 0 ---
115bool(false)
116--- testing: 9223372034707292160 / 1 ---
117int(9223372034707292160)
118--- testing: 9223372034707292160 / -1 ---
119int(-9223372034707292160)
120--- testing: 9223372034707292160 / 7 ---
121float(1.3176245763868E+18)
122--- testing: 9223372034707292160 / 9 ---
123float(1.0248191149675E+18)
124--- testing: 9223372034707292160 / 65 ---
125float(1.4189803130319E+17)
126--- testing: 9223372034707292160 / -44 ---
127float(-2.0962209169789E+17)
128--- testing: 9223372034707292160 / 2147483647 ---
129float(4294967297)
130--- testing: 9223372034707292160 / 9223372036854775807 ---
131float(0.99999999976717)
132--- testing: -9223372034707292160 / 0 ---
133bool(false)
134--- testing: -9223372034707292160 / 1 ---
135int(-9223372034707292160)
136--- testing: -9223372034707292160 / -1 ---
137int(9223372034707292160)
138--- testing: -9223372034707292160 / 7 ---
139float(-1.3176245763868E+18)
140--- testing: -9223372034707292160 / 9 ---
141float(-1.0248191149675E+18)
142--- testing: -9223372034707292160 / 65 ---
143float(-1.4189803130319E+17)
144--- testing: -9223372034707292160 / -44 ---
145float(2.0962209169789E+17)
146--- testing: -9223372034707292160 / 2147483647 ---
147float(-4294967297)
148--- testing: -9223372034707292160 / 9223372036854775807 ---
149float(-0.99999999976717)
150--- testing: 2147483648 / 0 ---
151bool(false)
152--- testing: 2147483648 / 1 ---
153int(2147483648)
154--- testing: 2147483648 / -1 ---
155int(-2147483648)
156--- testing: 2147483648 / 7 ---
157float(306783378.28571)
158--- testing: 2147483648 / 9 ---
159float(238609294.22222)
160--- testing: 2147483648 / 65 ---
161float(33038209.969231)
162--- testing: 2147483648 / -44 ---
163float(-48806446.545455)
164--- testing: 2147483648 / 2147483647 ---
165float(1.0000000004657)
166--- testing: 2147483648 / 9223372036854775807 ---
167float(2.3283064365387E-10)
168--- testing: -2147483649 / 0 ---
169bool(false)
170--- testing: -2147483649 / 1 ---
171int(-2147483649)
172--- testing: -2147483649 / -1 ---
173int(2147483649)
174--- testing: -2147483649 / 7 ---
175float(-306783378.42857)
176--- testing: -2147483649 / 9 ---
177float(-238609294.33333)
178--- testing: -2147483649 / 65 ---
179float(-33038209.984615)
180--- testing: -2147483649 / -44 ---
181float(48806446.568182)
182--- testing: -2147483649 / 2147483647 ---
183float(-1.0000000009313)
184--- testing: -2147483649 / 9223372036854775807 ---
185float(-2.3283064376229E-10)
186--- testing: 4294967294 / 0 ---
187bool(false)
188--- testing: 4294967294 / 1 ---
189int(4294967294)
190--- testing: 4294967294 / -1 ---
191int(-4294967294)
192--- testing: 4294967294 / 7 ---
193float(613566756.28571)
194--- testing: 4294967294 / 9 ---
195float(477218588.22222)
196--- testing: 4294967294 / 65 ---
197float(66076419.907692)
198--- testing: 4294967294 / -44 ---
199float(-97612893.045455)
200--- testing: 4294967294 / 2147483647 ---
201int(2)
202--- testing: 4294967294 / 9223372036854775807 ---
203float(4.656612870909E-10)
204--- testing: 4294967295 / 0 ---
205bool(false)
206--- testing: 4294967295 / 1 ---
207int(4294967295)
208--- testing: 4294967295 / -1 ---
209int(-4294967295)
210--- testing: 4294967295 / 7 ---
211float(613566756.42857)
212--- testing: 4294967295 / 9 ---
213float(477218588.33333)
214--- testing: 4294967295 / 65 ---
215float(66076419.923077)
216--- testing: 4294967295 / -44 ---
217float(-97612893.068182)
218--- testing: 4294967295 / 2147483647 ---
219float(2.0000000004657)
220--- testing: 4294967295 / 9223372036854775807 ---
221float(4.6566128719932E-10)
222--- testing: 4294967293 / 0 ---
223bool(false)
224--- testing: 4294967293 / 1 ---
225int(4294967293)
226--- testing: 4294967293 / -1 ---
227int(-4294967293)
228--- testing: 4294967293 / 7 ---
229float(613566756.14286)
230--- testing: 4294967293 / 9 ---
231float(477218588.11111)
232--- testing: 4294967293 / 65 ---
233float(66076419.892308)
234--- testing: 4294967293 / -44 ---
235float(-97612893.022727)
236--- testing: 4294967293 / 2147483647 ---
237float(1.9999999995343)
238--- testing: 4294967293 / 9223372036854775807 ---
239float(4.6566128698248E-10)
240--- testing: 9223372036854775806 / 0 ---
241bool(false)
242--- testing: 9223372036854775806 / 1 ---
243int(9223372036854775806)
244--- testing: 9223372036854775806 / -1 ---
245int(-9223372036854775806)
246--- testing: 9223372036854775806 / 7 ---
247float(1.3176245766935E+18)
248--- testing: 9223372036854775806 / 9 ---
249float(1.0248191152061E+18)
250--- testing: 9223372036854775806 / 65 ---
251float(1.4189803133623E+17)
252--- testing: 9223372036854775806 / -44 ---
253float(-2.096220917467E+17)
254--- testing: 9223372036854775806 / 2147483647 ---
255int(4294967298)
256--- testing: 9223372036854775806 / 9223372036854775807 ---
257float(1)
258--- testing: 9.2233720368548E+18 / 0 ---
259bool(false)
260--- testing: 9.2233720368548E+18 / 1 ---
261float(9.2233720368548E+18)
262--- testing: 9.2233720368548E+18 / -1 ---
263float(-9.2233720368548E+18)
264--- testing: 9.2233720368548E+18 / 7 ---
265float(1.3176245766935E+18)
266--- testing: 9.2233720368548E+18 / 9 ---
267float(1.0248191152061E+18)
268--- testing: 9.2233720368548E+18 / 65 ---
269float(1.4189803133623E+17)
270--- testing: 9.2233720368548E+18 / -44 ---
271float(-2.096220917467E+17)
272--- testing: 9.2233720368548E+18 / 2147483647 ---
273float(4294967298)
274--- testing: 9.2233720368548E+18 / 9223372036854775807 ---
275float(1)
276--- testing: -9223372036854775807 / 0 ---
277bool(false)
278--- testing: -9223372036854775807 / 1 ---
279int(-9223372036854775807)
280--- testing: -9223372036854775807 / -1 ---
281int(9223372036854775807)
282--- testing: -9223372036854775807 / 7 ---
283int(-1317624576693539401)
284--- testing: -9223372036854775807 / 9 ---
285float(-1.0248191152061E+18)
286--- testing: -9223372036854775807 / 65 ---
287float(-1.4189803133623E+17)
288--- testing: -9223372036854775807 / -44 ---
289float(2.096220917467E+17)
290--- testing: -9223372036854775807 / 2147483647 ---
291float(-4294967298)
292--- testing: -9223372036854775807 / 9223372036854775807 ---
293int(-1)
294--- testing: -9.2233720368548E+18 / 0 ---
295bool(false)
296--- testing: -9.2233720368548E+18 / 1 ---
297float(-9.2233720368548E+18)
298--- testing: -9.2233720368548E+18 / -1 ---
299float(9.2233720368548E+18)
300--- testing: -9.2233720368548E+18 / 7 ---
301float(-1.3176245766935E+18)
302--- testing: -9.2233720368548E+18 / 9 ---
303float(-1.0248191152061E+18)
304--- testing: -9.2233720368548E+18 / 65 ---
305float(-1.4189803133623E+17)
306--- testing: -9.2233720368548E+18 / -44 ---
307float(2.096220917467E+17)
308--- testing: -9.2233720368548E+18 / 2147483647 ---
309float(-4294967298)
310--- testing: -9.2233720368548E+18 / 9223372036854775807 ---
311float(-1)
312--- testing: 0 / 9223372036854775807 ---
313int(0)
314--- testing: 0 / -9223372036854775808 ---
315int(0)
316--- testing: 0 / 2147483647 ---
317int(0)
318--- testing: 0 / -2147483648 ---
319int(0)
320--- testing: 0 / 9223372034707292160 ---
321int(0)
322--- testing: 0 / -9223372034707292160 ---
323int(0)
324--- testing: 0 / 2147483648 ---
325int(0)
326--- testing: 0 / -2147483649 ---
327int(0)
328--- testing: 0 / 4294967294 ---
329int(0)
330--- testing: 0 / 4294967295 ---
331int(0)
332--- testing: 0 / 4294967293 ---
333int(0)
334--- testing: 0 / 9223372036854775806 ---
335int(0)
336--- testing: 0 / 9.2233720368548E+18 ---
337float(0)
338--- testing: 0 / -9223372036854775807 ---
339int(0)
340--- testing: 0 / -9.2233720368548E+18 ---
341float(-0)
342--- testing: 1 / 9223372036854775807 ---
343float(1.0842021724855E-19)
344--- testing: 1 / -9223372036854775808 ---
345float(-1.0842021724855E-19)
346--- testing: 1 / 2147483647 ---
347float(4.6566128752458E-10)
348--- testing: 1 / -2147483648 ---
349float(-4.6566128730774E-10)
350--- testing: 1 / 9223372034707292160 ---
351float(1.0842021727379E-19)
352--- testing: 1 / -9223372034707292160 ---
353float(-1.0842021727379E-19)
354--- testing: 1 / 2147483648 ---
355float(4.6566128730774E-10)
356--- testing: 1 / -2147483649 ---
357float(-4.656612870909E-10)
358--- testing: 1 / 4294967294 ---
359float(2.3283064376229E-10)
360--- testing: 1 / 4294967295 ---
361float(2.3283064370808E-10)
362--- testing: 1 / 4294967293 ---
363float(2.328306438165E-10)
364--- testing: 1 / 9223372036854775806 ---
365float(1.0842021724855E-19)
366--- testing: 1 / 9.2233720368548E+18 ---
367float(1.0842021724855E-19)
368--- testing: 1 / -9223372036854775807 ---
369float(-1.0842021724855E-19)
370--- testing: 1 / -9.2233720368548E+18 ---
371float(-1.0842021724855E-19)
372--- testing: -1 / 9223372036854775807 ---
373float(-1.0842021724855E-19)
374--- testing: -1 / -9223372036854775808 ---
375float(1.0842021724855E-19)
376--- testing: -1 / 2147483647 ---
377float(-4.6566128752458E-10)
378--- testing: -1 / -2147483648 ---
379float(4.6566128730774E-10)
380--- testing: -1 / 9223372034707292160 ---
381float(-1.0842021727379E-19)
382--- testing: -1 / -9223372034707292160 ---
383float(1.0842021727379E-19)
384--- testing: -1 / 2147483648 ---
385float(-4.6566128730774E-10)
386--- testing: -1 / -2147483649 ---
387float(4.656612870909E-10)
388--- testing: -1 / 4294967294 ---
389float(-2.3283064376229E-10)
390--- testing: -1 / 4294967295 ---
391float(-2.3283064370808E-10)
392--- testing: -1 / 4294967293 ---
393float(-2.328306438165E-10)
394--- testing: -1 / 9223372036854775806 ---
395float(-1.0842021724855E-19)
396--- testing: -1 / 9.2233720368548E+18 ---
397float(-1.0842021724855E-19)
398--- testing: -1 / -9223372036854775807 ---
399float(1.0842021724855E-19)
400--- testing: -1 / -9.2233720368548E+18 ---
401float(1.0842021724855E-19)
402--- testing: 7 / 9223372036854775807 ---
403float(7.5894152073985E-19)
404--- testing: 7 / -9223372036854775808 ---
405float(-7.5894152073985E-19)
406--- testing: 7 / 2147483647 ---
407float(3.2596290126721E-9)
408--- testing: 7 / -2147483648 ---
409float(-3.2596290111542E-9)
410--- testing: 7 / 9223372034707292160 ---
411float(7.5894152091656E-19)
412--- testing: 7 / -9223372034707292160 ---
413float(-7.5894152091656E-19)
414--- testing: 7 / 2147483648 ---
415float(3.2596290111542E-9)
416--- testing: 7 / -2147483649 ---
417float(-3.2596290096363E-9)
418--- testing: 7 / 4294967294 ---
419float(1.629814506336E-9)
420--- testing: 7 / 4294967295 ---
421float(1.6298145059566E-9)
422--- testing: 7 / 4294967293 ---
423float(1.6298145067155E-9)
424--- testing: 7 / 9223372036854775806 ---
425float(7.5894152073985E-19)
426--- testing: 7 / 9.2233720368548E+18 ---
427float(7.5894152073985E-19)
428--- testing: 7 / -9223372036854775807 ---
429float(-7.5894152073985E-19)
430--- testing: 7 / -9.2233720368548E+18 ---
431float(-7.5894152073985E-19)
432--- testing: 9 / 9223372036854775807 ---
433float(9.7578195523695E-19)
434--- testing: 9 / -9223372036854775808 ---
435float(-9.7578195523695E-19)
436--- testing: 9 / 2147483647 ---
437float(4.1909515877212E-9)
438--- testing: 9 / -2147483648 ---
439float(-4.1909515857697E-9)
440--- testing: 9 / 9223372034707292160 ---
441float(9.7578195546415E-19)
442--- testing: 9 / -9223372034707292160 ---
443float(-9.7578195546415E-19)
444--- testing: 9 / 2147483648 ---
445float(4.1909515857697E-9)
446--- testing: 9 / -2147483649 ---
447float(-4.1909515838181E-9)
448--- testing: 9 / 4294967294 ---
449float(2.0954757938606E-9)
450--- testing: 9 / 4294967295 ---
451float(2.0954757933727E-9)
452--- testing: 9 / 4294967293 ---
453float(2.0954757943485E-9)
454--- testing: 9 / 9223372036854775806 ---
455float(9.7578195523695E-19)
456--- testing: 9 / 9.2233720368548E+18 ---
457float(9.7578195523695E-19)
458--- testing: 9 / -9223372036854775807 ---
459float(-9.7578195523695E-19)
460--- testing: 9 / -9.2233720368548E+18 ---
461float(-9.7578195523695E-19)
462--- testing: 65 / 9223372036854775807 ---
463float(7.0473141211558E-18)
464--- testing: 65 / -9223372036854775808 ---
465float(-7.0473141211558E-18)
466--- testing: 65 / 2147483647 ---
467float(3.0267983689098E-8)
468--- testing: 65 / -2147483648 ---
469float(-3.0267983675003E-8)
470--- testing: 65 / 9223372034707292160 ---
471float(7.0473141227966E-18)
472--- testing: 65 / -9223372034707292160 ---
473float(-7.0473141227966E-18)
474--- testing: 65 / 2147483648 ---
475float(3.0267983675003E-8)
476--- testing: 65 / -2147483649 ---
477float(-3.0267983660908E-8)
478--- testing: 65 / 4294967294 ---
479float(1.5133991844549E-8)
480--- testing: 65 / 4294967295 ---
481float(1.5133991841025E-8)
482--- testing: 65 / 4294967293 ---
483float(1.5133991848072E-8)
484--- testing: 65 / 9223372036854775806 ---
485float(7.0473141211558E-18)
486--- testing: 65 / 9.2233720368548E+18 ---
487float(7.0473141211558E-18)
488--- testing: 65 / -9223372036854775807 ---
489float(-7.0473141211558E-18)
490--- testing: 65 / -9.2233720368548E+18 ---
491float(-7.0473141211558E-18)
492--- testing: -44 / 9223372036854775807 ---
493float(-4.7704895589362E-18)
494--- testing: -44 / -9223372036854775808 ---
495float(4.7704895589362E-18)
496--- testing: -44 / 2147483647 ---
497float(-2.0489096651082E-8)
498--- testing: -44 / -2147483648 ---
499float(2.0489096641541E-8)
500--- testing: -44 / 9223372034707292160 ---
501float(-4.7704895600469E-18)
502--- testing: -44 / -9223372034707292160 ---
503float(4.7704895600469E-18)
504--- testing: -44 / 2147483648 ---
505float(-2.0489096641541E-8)
506--- testing: -44 / -2147483649 ---
507float(2.0489096632E-8)
508--- testing: -44 / 4294967294 ---
509float(-1.0244548325541E-8)
510--- testing: -44 / 4294967295 ---
511float(-1.0244548323156E-8)
512--- testing: -44 / 4294967293 ---
513float(-1.0244548327926E-8)
514--- testing: -44 / 9223372036854775806 ---
515float(-4.7704895589362E-18)
516--- testing: -44 / 9.2233720368548E+18 ---
517float(-4.7704895589362E-18)
518--- testing: -44 / -9223372036854775807 ---
519float(4.7704895589362E-18)
520--- testing: -44 / -9.2233720368548E+18 ---
521float(4.7704895589362E-18)
522--- testing: 2147483647 / 9223372036854775807 ---
523float(2.3283064354545E-10)
524--- testing: 2147483647 / -9223372036854775808 ---
525float(-2.3283064354545E-10)
526--- testing: 2147483647 / 2147483647 ---
527int(1)
528--- testing: 2147483647 / -2147483648 ---
529float(-0.99999999953434)
530--- testing: 2147483647 / 9223372034707292160 ---
531float(2.3283064359966E-10)
532--- testing: 2147483647 / -9223372034707292160 ---
533float(-2.3283064359966E-10)
534--- testing: 2147483647 / 2147483648 ---
535float(0.99999999953434)
536--- testing: 2147483647 / -2147483649 ---
537float(-0.99999999906868)
538--- testing: 2147483647 / 4294967294 ---
539float(0.5)
540--- testing: 2147483647 / 4294967295 ---
541float(0.49999999988358)
542--- testing: 2147483647 / 4294967293 ---
543float(0.50000000011642)
544--- testing: 2147483647 / 9223372036854775806 ---
545float(2.3283064354545E-10)
546--- testing: 2147483647 / 9.2233720368548E+18 ---
547float(2.3283064354545E-10)
548--- testing: 2147483647 / -9223372036854775807 ---
549float(-2.3283064354545E-10)
550--- testing: 2147483647 / -9.2233720368548E+18 ---
551float(-2.3283064354545E-10)
552--- testing: 9223372036854775807 / 9223372036854775807 ---
553int(1)
554--- testing: 9223372036854775807 / -9223372036854775808 ---
555float(-1)
556--- testing: 9223372036854775807 / 2147483647 ---
557float(4294967298)
558--- testing: 9223372036854775807 / -2147483648 ---
559float(-4294967296)
560--- testing: 9223372036854775807 / 9223372034707292160 ---
561float(1.0000000002328)
562--- testing: 9223372036854775807 / -9223372034707292160 ---
563float(-1.0000000002328)
564--- testing: 9223372036854775807 / 2147483648 ---
565float(4294967296)
566--- testing: 9223372036854775807 / -2147483649 ---
567float(-4294967294)
568--- testing: 9223372036854775807 / 4294967294 ---
569float(2147483649)
570--- testing: 9223372036854775807 / 4294967295 ---
571float(2147483648.5)
572--- testing: 9223372036854775807 / 4294967293 ---
573float(2147483649.5)
574--- testing: 9223372036854775807 / 9223372036854775806 ---
575float(1)
576--- testing: 9223372036854775807 / 9.2233720368548E+18 ---
577float(1)
578--- testing: 9223372036854775807 / -9223372036854775807 ---
579int(-1)
580--- testing: 9223372036854775807 / -9.2233720368548E+18 ---
581float(-1)
582===DONE===
583