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 ---
43int(0)
44--- testing: 9223372036854775807 * 1 ---
45int(9223372036854775807)
46--- testing: 9223372036854775807 * -1 ---
47int(-9223372036854775807)
48--- testing: 9223372036854775807 * 7 ---
49float(6.4563604257983E+19)
50--- testing: 9223372036854775807 * 9 ---
51float(8.3010348331693E+19)
52--- testing: 9223372036854775807 * 65 ---
53float(5.9951918239556E+20)
54--- testing: 9223372036854775807 * -44 ---
55float(-4.0582836962161E+20)
56--- testing: 9223372036854775807 * 2147483647 ---
57float(1.9807040619343E+28)
58--- testing: 9223372036854775807 * 9223372036854775807 ---
59float(8.5070591730235E+37)
60--- testing: -9223372036854775808 * 0 ---
61int(0)
62--- testing: -9223372036854775808 * 1 ---
63int(-9223372036854775808)
64--- testing: -9223372036854775808 * -1 ---
65float(9.2233720368548E+18)
66--- testing: -9223372036854775808 * 7 ---
67float(-6.4563604257983E+19)
68--- testing: -9223372036854775808 * 9 ---
69float(-8.3010348331693E+19)
70--- testing: -9223372036854775808 * 65 ---
71float(-5.9951918239556E+20)
72--- testing: -9223372036854775808 * -44 ---
73float(4.0582836962161E+20)
74--- testing: -9223372036854775808 * 2147483647 ---
75float(-1.9807040619343E+28)
76--- testing: -9223372036854775808 * 9223372036854775807 ---
77float(-8.5070591730235E+37)
78--- testing: 2147483647 * 0 ---
79int(0)
80--- testing: 2147483647 * 1 ---
81int(2147483647)
82--- testing: 2147483647 * -1 ---
83int(-2147483647)
84--- testing: 2147483647 * 7 ---
85int(15032385529)
86--- testing: 2147483647 * 9 ---
87int(19327352823)
88--- testing: 2147483647 * 65 ---
89int(139586437055)
90--- testing: 2147483647 * -44 ---
91int(-94489280468)
92--- testing: 2147483647 * 2147483647 ---
93int(4611686014132420609)
94--- testing: 2147483647 * 9223372036854775807 ---
95float(1.9807040619343E+28)
96--- testing: -2147483648 * 0 ---
97int(0)
98--- testing: -2147483648 * 1 ---
99int(-2147483648)
100--- testing: -2147483648 * -1 ---
101int(2147483648)
102--- testing: -2147483648 * 7 ---
103int(-15032385536)
104--- testing: -2147483648 * 9 ---
105int(-19327352832)
106--- testing: -2147483648 * 65 ---
107int(-139586437120)
108--- testing: -2147483648 * -44 ---
109int(94489280512)
110--- testing: -2147483648 * 2147483647 ---
111int(-4611686016279904256)
112--- testing: -2147483648 * 9223372036854775807 ---
113float(-1.9807040628566E+28)
114--- testing: 9223372034707292160 * 0 ---
115int(0)
116--- testing: 9223372034707292160 * 1 ---
117int(9223372034707292160)
118--- testing: 9223372034707292160 * -1 ---
119int(-9223372034707292160)
120--- testing: 9223372034707292160 * 7 ---
121float(6.4563604242951E+19)
122--- testing: 9223372034707292160 * 9 ---
123float(8.3010348312366E+19)
124--- testing: 9223372034707292160 * 65 ---
125float(5.9951918225597E+20)
126--- testing: 9223372034707292160 * -44 ---
127float(-4.0582836952712E+20)
128--- testing: 9223372034707292160 * 2147483647 ---
129float(1.9807040614731E+28)
130--- testing: 9223372034707292160 * 9223372036854775807 ---
131float(8.5070591710428E+37)
132--- testing: -9223372034707292160 * 0 ---
133int(0)
134--- testing: -9223372034707292160 * 1 ---
135int(-9223372034707292160)
136--- testing: -9223372034707292160 * -1 ---
137int(9223372034707292160)
138--- testing: -9223372034707292160 * 7 ---
139float(-6.4563604242951E+19)
140--- testing: -9223372034707292160 * 9 ---
141float(-8.3010348312366E+19)
142--- testing: -9223372034707292160 * 65 ---
143float(-5.9951918225597E+20)
144--- testing: -9223372034707292160 * -44 ---
145float(4.0582836952712E+20)
146--- testing: -9223372034707292160 * 2147483647 ---
147float(-1.9807040614731E+28)
148--- testing: -9223372034707292160 * 9223372036854775807 ---
149float(-8.5070591710428E+37)
150--- testing: 2147483648 * 0 ---
151int(0)
152--- testing: 2147483648 * 1 ---
153int(2147483648)
154--- testing: 2147483648 * -1 ---
155int(-2147483648)
156--- testing: 2147483648 * 7 ---
157int(15032385536)
158--- testing: 2147483648 * 9 ---
159int(19327352832)
160--- testing: 2147483648 * 65 ---
161int(139586437120)
162--- testing: 2147483648 * -44 ---
163int(-94489280512)
164--- testing: 2147483648 * 2147483647 ---
165int(4611686016279904256)
166--- testing: 2147483648 * 9223372036854775807 ---
167float(1.9807040628566E+28)
168--- testing: -2147483649 * 0 ---
169int(0)
170--- testing: -2147483649 * 1 ---
171int(-2147483649)
172--- testing: -2147483649 * -1 ---
173int(2147483649)
174--- testing: -2147483649 * 7 ---
175int(-15032385543)
176--- testing: -2147483649 * 9 ---
177int(-19327352841)
178--- testing: -2147483649 * 65 ---
179int(-139586437185)
180--- testing: -2147483649 * -44 ---
181int(94489280556)
182--- testing: -2147483649 * 2147483647 ---
183int(-4611686018427387903)
184--- testing: -2147483649 * 9223372036854775807 ---
185float(-1.9807040637789E+28)
186--- testing: 4294967294 * 0 ---
187int(0)
188--- testing: 4294967294 * 1 ---
189int(4294967294)
190--- testing: 4294967294 * -1 ---
191int(-4294967294)
192--- testing: 4294967294 * 7 ---
193int(30064771058)
194--- testing: 4294967294 * 9 ---
195int(38654705646)
196--- testing: 4294967294 * 65 ---
197int(279172874110)
198--- testing: 4294967294 * -44 ---
199int(-188978560936)
200--- testing: 4294967294 * 2147483647 ---
201int(9223372028264841218)
202--- testing: 4294967294 * 9223372036854775807 ---
203float(3.9614081238685E+28)
204--- testing: 4294967295 * 0 ---
205int(0)
206--- testing: 4294967295 * 1 ---
207int(4294967295)
208--- testing: 4294967295 * -1 ---
209int(-4294967295)
210--- testing: 4294967295 * 7 ---
211int(30064771065)
212--- testing: 4294967295 * 9 ---
213int(38654705655)
214--- testing: 4294967295 * 65 ---
215int(279172874175)
216--- testing: 4294967295 * -44 ---
217int(-188978560980)
218--- testing: 4294967295 * 2147483647 ---
219int(9223372030412324865)
220--- testing: 4294967295 * 9223372036854775807 ---
221float(3.9614081247909E+28)
222--- testing: 4294967293 * 0 ---
223int(0)
224--- testing: 4294967293 * 1 ---
225int(4294967293)
226--- testing: 4294967293 * -1 ---
227int(-4294967293)
228--- testing: 4294967293 * 7 ---
229int(30064771051)
230--- testing: 4294967293 * 9 ---
231int(38654705637)
232--- testing: 4294967293 * 65 ---
233int(279172874045)
234--- testing: 4294967293 * -44 ---
235int(-188978560892)
236--- testing: 4294967293 * 2147483647 ---
237int(9223372026117357571)
238--- testing: 4294967293 * 9223372036854775807 ---
239float(3.9614081229462E+28)
240--- testing: 9223372036854775806 * 0 ---
241int(0)
242--- testing: 9223372036854775806 * 1 ---
243int(9223372036854775806)
244--- testing: 9223372036854775806 * -1 ---
245int(-9223372036854775806)
246--- testing: 9223372036854775806 * 7 ---
247float(6.4563604257983E+19)
248--- testing: 9223372036854775806 * 9 ---
249float(8.3010348331693E+19)
250--- testing: 9223372036854775806 * 65 ---
251float(5.9951918239556E+20)
252--- testing: 9223372036854775806 * -44 ---
253float(-4.0582836962161E+20)
254--- testing: 9223372036854775806 * 2147483647 ---
255float(1.9807040619343E+28)
256--- testing: 9223372036854775806 * 9223372036854775807 ---
257float(8.5070591730235E+37)
258--- testing: 9.2233720368548E+18 * 0 ---
259float(0)
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(6.4563604257983E+19)
266--- testing: 9.2233720368548E+18 * 9 ---
267float(8.3010348331693E+19)
268--- testing: 9.2233720368548E+18 * 65 ---
269float(5.9951918239556E+20)
270--- testing: 9.2233720368548E+18 * -44 ---
271float(-4.0582836962161E+20)
272--- testing: 9.2233720368548E+18 * 2147483647 ---
273float(1.9807040619343E+28)
274--- testing: 9.2233720368548E+18 * 9223372036854775807 ---
275float(8.5070591730235E+37)
276--- testing: -9223372036854775807 * 0 ---
277int(0)
278--- testing: -9223372036854775807 * 1 ---
279int(-9223372036854775807)
280--- testing: -9223372036854775807 * -1 ---
281int(9223372036854775807)
282--- testing: -9223372036854775807 * 7 ---
283float(-6.4563604257983E+19)
284--- testing: -9223372036854775807 * 9 ---
285float(-8.3010348331693E+19)
286--- testing: -9223372036854775807 * 65 ---
287float(-5.9951918239556E+20)
288--- testing: -9223372036854775807 * -44 ---
289float(4.0582836962161E+20)
290--- testing: -9223372036854775807 * 2147483647 ---
291float(-1.9807040619343E+28)
292--- testing: -9223372036854775807 * 9223372036854775807 ---
293float(-8.5070591730235E+37)
294--- testing: -9.2233720368548E+18 * 0 ---
295float(-0)
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(-6.4563604257983E+19)
302--- testing: -9.2233720368548E+18 * 9 ---
303float(-8.3010348331693E+19)
304--- testing: -9.2233720368548E+18 * 65 ---
305float(-5.9951918239556E+20)
306--- testing: -9.2233720368548E+18 * -44 ---
307float(4.0582836962161E+20)
308--- testing: -9.2233720368548E+18 * 2147483647 ---
309float(-1.9807040619343E+28)
310--- testing: -9.2233720368548E+18 * 9223372036854775807 ---
311float(-8.5070591730235E+37)
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 ---
343int(9223372036854775807)
344--- testing: 1 * -9223372036854775808 ---
345int(-9223372036854775808)
346--- testing: 1 * 2147483647 ---
347int(2147483647)
348--- testing: 1 * -2147483648 ---
349int(-2147483648)
350--- testing: 1 * 9223372034707292160 ---
351int(9223372034707292160)
352--- testing: 1 * -9223372034707292160 ---
353int(-9223372034707292160)
354--- testing: 1 * 2147483648 ---
355int(2147483648)
356--- testing: 1 * -2147483649 ---
357int(-2147483649)
358--- testing: 1 * 4294967294 ---
359int(4294967294)
360--- testing: 1 * 4294967295 ---
361int(4294967295)
362--- testing: 1 * 4294967293 ---
363int(4294967293)
364--- testing: 1 * 9223372036854775806 ---
365int(9223372036854775806)
366--- testing: 1 * 9.2233720368548E+18 ---
367float(9.2233720368548E+18)
368--- testing: 1 * -9223372036854775807 ---
369int(-9223372036854775807)
370--- testing: 1 * -9.2233720368548E+18 ---
371float(-9.2233720368548E+18)
372--- testing: -1 * 9223372036854775807 ---
373int(-9223372036854775807)
374--- testing: -1 * -9223372036854775808 ---
375float(9.2233720368548E+18)
376--- testing: -1 * 2147483647 ---
377int(-2147483647)
378--- testing: -1 * -2147483648 ---
379int(2147483648)
380--- testing: -1 * 9223372034707292160 ---
381int(-9223372034707292160)
382--- testing: -1 * -9223372034707292160 ---
383int(9223372034707292160)
384--- testing: -1 * 2147483648 ---
385int(-2147483648)
386--- testing: -1 * -2147483649 ---
387int(2147483649)
388--- testing: -1 * 4294967294 ---
389int(-4294967294)
390--- testing: -1 * 4294967295 ---
391int(-4294967295)
392--- testing: -1 * 4294967293 ---
393int(-4294967293)
394--- testing: -1 * 9223372036854775806 ---
395int(-9223372036854775806)
396--- testing: -1 * 9.2233720368548E+18 ---
397float(-9.2233720368548E+18)
398--- testing: -1 * -9223372036854775807 ---
399int(9223372036854775807)
400--- testing: -1 * -9.2233720368548E+18 ---
401float(9.2233720368548E+18)
402--- testing: 7 * 9223372036854775807 ---
403float(6.4563604257983E+19)
404--- testing: 7 * -9223372036854775808 ---
405float(-6.4563604257983E+19)
406--- testing: 7 * 2147483647 ---
407int(15032385529)
408--- testing: 7 * -2147483648 ---
409int(-15032385536)
410--- testing: 7 * 9223372034707292160 ---
411float(6.4563604242951E+19)
412--- testing: 7 * -9223372034707292160 ---
413float(-6.4563604242951E+19)
414--- testing: 7 * 2147483648 ---
415int(15032385536)
416--- testing: 7 * -2147483649 ---
417int(-15032385543)
418--- testing: 7 * 4294967294 ---
419int(30064771058)
420--- testing: 7 * 4294967295 ---
421int(30064771065)
422--- testing: 7 * 4294967293 ---
423int(30064771051)
424--- testing: 7 * 9223372036854775806 ---
425float(6.4563604257983E+19)
426--- testing: 7 * 9.2233720368548E+18 ---
427float(6.4563604257983E+19)
428--- testing: 7 * -9223372036854775807 ---
429float(-6.4563604257983E+19)
430--- testing: 7 * -9.2233720368548E+18 ---
431float(-6.4563604257983E+19)
432--- testing: 9 * 9223372036854775807 ---
433float(8.3010348331693E+19)
434--- testing: 9 * -9223372036854775808 ---
435float(-8.3010348331693E+19)
436--- testing: 9 * 2147483647 ---
437int(19327352823)
438--- testing: 9 * -2147483648 ---
439int(-19327352832)
440--- testing: 9 * 9223372034707292160 ---
441float(8.3010348312366E+19)
442--- testing: 9 * -9223372034707292160 ---
443float(-8.3010348312366E+19)
444--- testing: 9 * 2147483648 ---
445int(19327352832)
446--- testing: 9 * -2147483649 ---
447int(-19327352841)
448--- testing: 9 * 4294967294 ---
449int(38654705646)
450--- testing: 9 * 4294967295 ---
451int(38654705655)
452--- testing: 9 * 4294967293 ---
453int(38654705637)
454--- testing: 9 * 9223372036854775806 ---
455float(8.3010348331693E+19)
456--- testing: 9 * 9.2233720368548E+18 ---
457float(8.3010348331693E+19)
458--- testing: 9 * -9223372036854775807 ---
459float(-8.3010348331693E+19)
460--- testing: 9 * -9.2233720368548E+18 ---
461float(-8.3010348331693E+19)
462--- testing: 65 * 9223372036854775807 ---
463float(5.9951918239556E+20)
464--- testing: 65 * -9223372036854775808 ---
465float(-5.9951918239556E+20)
466--- testing: 65 * 2147483647 ---
467int(139586437055)
468--- testing: 65 * -2147483648 ---
469int(-139586437120)
470--- testing: 65 * 9223372034707292160 ---
471float(5.9951918225597E+20)
472--- testing: 65 * -9223372034707292160 ---
473float(-5.9951918225597E+20)
474--- testing: 65 * 2147483648 ---
475int(139586437120)
476--- testing: 65 * -2147483649 ---
477int(-139586437185)
478--- testing: 65 * 4294967294 ---
479int(279172874110)
480--- testing: 65 * 4294967295 ---
481int(279172874175)
482--- testing: 65 * 4294967293 ---
483int(279172874045)
484--- testing: 65 * 9223372036854775806 ---
485float(5.9951918239556E+20)
486--- testing: 65 * 9.2233720368548E+18 ---
487float(5.9951918239556E+20)
488--- testing: 65 * -9223372036854775807 ---
489float(-5.9951918239556E+20)
490--- testing: 65 * -9.2233720368548E+18 ---
491float(-5.9951918239556E+20)
492--- testing: -44 * 9223372036854775807 ---
493float(-4.0582836962161E+20)
494--- testing: -44 * -9223372036854775808 ---
495float(4.0582836962161E+20)
496--- testing: -44 * 2147483647 ---
497int(-94489280468)
498--- testing: -44 * -2147483648 ---
499int(94489280512)
500--- testing: -44 * 9223372034707292160 ---
501float(-4.0582836952712E+20)
502--- testing: -44 * -9223372034707292160 ---
503float(4.0582836952712E+20)
504--- testing: -44 * 2147483648 ---
505int(-94489280512)
506--- testing: -44 * -2147483649 ---
507int(94489280556)
508--- testing: -44 * 4294967294 ---
509int(-188978560936)
510--- testing: -44 * 4294967295 ---
511int(-188978560980)
512--- testing: -44 * 4294967293 ---
513int(-188978560892)
514--- testing: -44 * 9223372036854775806 ---
515float(-4.0582836962161E+20)
516--- testing: -44 * 9.2233720368548E+18 ---
517float(-4.0582836962161E+20)
518--- testing: -44 * -9223372036854775807 ---
519float(4.0582836962161E+20)
520--- testing: -44 * -9.2233720368548E+18 ---
521float(4.0582836962161E+20)
522--- testing: 2147483647 * 9223372036854775807 ---
523float(1.9807040619343E+28)
524--- testing: 2147483647 * -9223372036854775808 ---
525float(-1.9807040619343E+28)
526--- testing: 2147483647 * 2147483647 ---
527int(4611686014132420609)
528--- testing: 2147483647 * -2147483648 ---
529int(-4611686016279904256)
530--- testing: 2147483647 * 9223372034707292160 ---
531float(1.9807040614731E+28)
532--- testing: 2147483647 * -9223372034707292160 ---
533float(-1.9807040614731E+28)
534--- testing: 2147483647 * 2147483648 ---
535int(4611686016279904256)
536--- testing: 2147483647 * -2147483649 ---
537int(-4611686018427387903)
538--- testing: 2147483647 * 4294967294 ---
539int(9223372028264841218)
540--- testing: 2147483647 * 4294967295 ---
541int(9223372030412324865)
542--- testing: 2147483647 * 4294967293 ---
543int(9223372026117357571)
544--- testing: 2147483647 * 9223372036854775806 ---
545float(1.9807040619343E+28)
546--- testing: 2147483647 * 9.2233720368548E+18 ---
547float(1.9807040619343E+28)
548--- testing: 2147483647 * -9223372036854775807 ---
549float(-1.9807040619343E+28)
550--- testing: 2147483647 * -9.2233720368548E+18 ---
551float(-1.9807040619343E+28)
552--- testing: 9223372036854775807 * 9223372036854775807 ---
553float(8.5070591730235E+37)
554--- testing: 9223372036854775807 * -9223372036854775808 ---
555float(-8.5070591730235E+37)
556--- testing: 9223372036854775807 * 2147483647 ---
557float(1.9807040619343E+28)
558--- testing: 9223372036854775807 * -2147483648 ---
559float(-1.9807040628566E+28)
560--- testing: 9223372036854775807 * 9223372034707292160 ---
561float(8.5070591710428E+37)
562--- testing: 9223372036854775807 * -9223372034707292160 ---
563float(-8.5070591710428E+37)
564--- testing: 9223372036854775807 * 2147483648 ---
565float(1.9807040628566E+28)
566--- testing: 9223372036854775807 * -2147483649 ---
567float(-1.9807040637789E+28)
568--- testing: 9223372036854775807 * 4294967294 ---
569float(3.9614081238685E+28)
570--- testing: 9223372036854775807 * 4294967295 ---
571float(3.9614081247909E+28)
572--- testing: 9223372036854775807 * 4294967293 ---
573float(3.9614081229462E+28)
574--- testing: 9223372036854775807 * 9223372036854775806 ---
575float(8.5070591730235E+37)
576--- testing: 9223372036854775807 * 9.2233720368548E+18 ---
577float(8.5070591730235E+37)
578--- testing: 9223372036854775807 * -9223372036854775807 ---
579float(-8.5070591730235E+37)
580--- testing: 9223372036854775807 * -9.2233720368548E+18 ---
581float(-8.5070591730235E+37)
582===DONE===
583