1--TEST--
2Test pow function : 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, MIN_32Bit, MAX_64Bit, MIN_64Bit);
22
23
24foreach ($longVals as $longVal) {
25   foreach($otherVals as $otherVal) {
26	   echo "--- testing: $longVal, $otherVal ---\n";
27      var_dump(pow($longVal, $otherVal));
28   }
29}
30
31?>
32===DONE===
33--EXPECT--
34--- testing: 9223372036854775807, 0 ---
35int(1)
36--- testing: 9223372036854775807, 1 ---
37int(9223372036854775807)
38--- testing: 9223372036854775807, -1 ---
39float(1.0842021724855E-19)
40--- testing: 9223372036854775807, 7 ---
41float(5.6784275335594E+132)
42--- testing: 9223372036854775807, 9 ---
43float(4.8306719037716E+170)
44--- testing: 9223372036854775807, 65 ---
45float(INF)
46--- testing: 9223372036854775807, -44 ---
47float(0)
48--- testing: 9223372036854775807, 2147483647 ---
49float(INF)
50--- testing: 9223372036854775807, -2147483648 ---
51float(0)
52--- testing: 9223372036854775807, 9223372036854775807 ---
53float(INF)
54--- testing: 9223372036854775807, -9223372036854775808 ---
55float(0)
56--- testing: -9223372036854775808, 0 ---
57int(1)
58--- testing: -9223372036854775808, 1 ---
59int(-9223372036854775808)
60--- testing: -9223372036854775808, -1 ---
61float(-1.0842021724855E-19)
62--- testing: -9223372036854775808, 7 ---
63float(-5.6784275335594E+132)
64--- testing: -9223372036854775808, 9 ---
65float(-4.8306719037716E+170)
66--- testing: -9223372036854775808, 65 ---
67float(-INF)
68--- testing: -9223372036854775808, -44 ---
69float(0)
70--- testing: -9223372036854775808, 2147483647 ---
71float(-INF)
72--- testing: -9223372036854775808, -2147483648 ---
73float(0)
74--- testing: -9223372036854775808, 9223372036854775807 ---
75float(-INF)
76--- testing: -9223372036854775808, -9223372036854775808 ---
77float(0)
78--- testing: 2147483647, 0 ---
79int(1)
80--- testing: 2147483647, 1 ---
81int(2147483647)
82--- testing: 2147483647, -1 ---
83float(4.6566128752458E-10)
84--- testing: 2147483647, 7 ---
85float(2.1062458265056E+65)
86--- testing: 2147483647, 9 ---
87float(9.7133444204205E+83)
88--- testing: 2147483647, 65 ---
89float(INF)
90--- testing: 2147483647, -44 ---
91float(0)
92--- testing: 2147483647, 2147483647 ---
93float(INF)
94--- testing: 2147483647, -2147483648 ---
95float(0)
96--- testing: 2147483647, 9223372036854775807 ---
97float(INF)
98--- testing: 2147483647, -9223372036854775808 ---
99float(0)
100--- testing: -2147483648, 0 ---
101int(1)
102--- testing: -2147483648, 1 ---
103int(-2147483648)
104--- testing: -2147483648, -1 ---
105float(-4.6566128730774E-10)
106--- testing: -2147483648, 7 ---
107float(-2.1062458333711E+65)
108--- testing: -2147483648, 9 ---
109float(-9.7133444611286E+83)
110--- testing: -2147483648, 65 ---
111float(-INF)
112--- testing: -2147483648, -44 ---
113float(0)
114--- testing: -2147483648, 2147483647 ---
115float(-INF)
116--- testing: -2147483648, -2147483648 ---
117float(0)
118--- testing: -2147483648, 9223372036854775807 ---
119float(-INF)
120--- testing: -2147483648, -9223372036854775808 ---
121float(0)
122--- testing: 9223372034707292160, 0 ---
123int(1)
124--- testing: 9223372034707292160, 1 ---
125int(9223372034707292160)
126--- testing: 9223372034707292160, -1 ---
127float(1.0842021727379E-19)
128--- testing: 9223372034707292160, 7 ---
129float(5.6784275243046E+132)
130--- testing: 9223372034707292160, 9 ---
131float(4.830671893649E+170)
132--- testing: 9223372034707292160, 65 ---
133float(INF)
134--- testing: 9223372034707292160, -44 ---
135float(0)
136--- testing: 9223372034707292160, 2147483647 ---
137float(INF)
138--- testing: 9223372034707292160, -2147483648 ---
139float(0)
140--- testing: 9223372034707292160, 9223372036854775807 ---
141float(INF)
142--- testing: 9223372034707292160, -9223372036854775808 ---
143float(0)
144--- testing: -9223372034707292160, 0 ---
145int(1)
146--- testing: -9223372034707292160, 1 ---
147int(-9223372034707292160)
148--- testing: -9223372034707292160, -1 ---
149float(-1.0842021727379E-19)
150--- testing: -9223372034707292160, 7 ---
151float(-5.6784275243046E+132)
152--- testing: -9223372034707292160, 9 ---
153float(-4.830671893649E+170)
154--- testing: -9223372034707292160, 65 ---
155float(-INF)
156--- testing: -9223372034707292160, -44 ---
157float(0)
158--- testing: -9223372034707292160, 2147483647 ---
159float(-INF)
160--- testing: -9223372034707292160, -2147483648 ---
161float(0)
162--- testing: -9223372034707292160, 9223372036854775807 ---
163float(-INF)
164--- testing: -9223372034707292160, -9223372036854775808 ---
165float(0)
166--- testing: 2147483648, 0 ---
167int(1)
168--- testing: 2147483648, 1 ---
169int(2147483648)
170--- testing: 2147483648, -1 ---
171float(4.6566128730774E-10)
172--- testing: 2147483648, 7 ---
173float(2.1062458333711E+65)
174--- testing: 2147483648, 9 ---
175float(9.7133444611286E+83)
176--- testing: 2147483648, 65 ---
177float(INF)
178--- testing: 2147483648, -44 ---
179float(0)
180--- testing: 2147483648, 2147483647 ---
181float(INF)
182--- testing: 2147483648, -2147483648 ---
183float(0)
184--- testing: 2147483648, 9223372036854775807 ---
185float(INF)
186--- testing: 2147483648, -9223372036854775808 ---
187float(0)
188--- testing: -2147483649, 0 ---
189int(1)
190--- testing: -2147483649, 1 ---
191int(-2147483649)
192--- testing: -2147483649, -1 ---
193float(-4.656612870909E-10)
194--- testing: -2147483649, 7 ---
195float(-2.1062458402367E+65)
196--- testing: -2147483649, 9 ---
197float(-9.7133445018368E+83)
198--- testing: -2147483649, 65 ---
199float(-INF)
200--- testing: -2147483649, -44 ---
201float(0)
202--- testing: -2147483649, 2147483647 ---
203float(-INF)
204--- testing: -2147483649, -2147483648 ---
205float(0)
206--- testing: -2147483649, 9223372036854775807 ---
207float(-INF)
208--- testing: -2147483649, -9223372036854775808 ---
209float(0)
210--- testing: 4294967294, 0 ---
211int(1)
212--- testing: 4294967294, 1 ---
213int(4294967294)
214--- testing: 4294967294, -1 ---
215float(2.3283064376229E-10)
216--- testing: 4294967294, 7 ---
217float(2.6959946579271E+67)
218--- testing: 4294967294, 9 ---
219float(4.9732323432553E+86)
220--- testing: 4294967294, 65 ---
221float(INF)
222--- testing: 4294967294, -44 ---
223float(0)
224--- testing: 4294967294, 2147483647 ---
225float(INF)
226--- testing: 4294967294, -2147483648 ---
227float(0)
228--- testing: 4294967294, 9223372036854775807 ---
229float(INF)
230--- testing: 4294967294, -9223372036854775808 ---
231float(0)
232--- testing: 4294967295, 0 ---
233int(1)
234--- testing: 4294967295, 1 ---
235int(4294967295)
236--- testing: 4294967295, -1 ---
237float(2.3283064370808E-10)
238--- testing: 4294967295, 7 ---
239float(2.6959946623211E+67)
240--- testing: 4294967295, 9 ---
241float(4.9732323536766E+86)
242--- testing: 4294967295, 65 ---
243float(INF)
244--- testing: 4294967295, -44 ---
245float(0)
246--- testing: 4294967295, 2147483647 ---
247float(INF)
248--- testing: 4294967295, -2147483648 ---
249float(0)
250--- testing: 4294967295, 9223372036854775807 ---
251float(INF)
252--- testing: 4294967295, -9223372036854775808 ---
253float(0)
254--- testing: 4294967293, 0 ---
255int(1)
256--- testing: 4294967293, 1 ---
257int(4294967293)
258--- testing: 4294967293, -1 ---
259float(2.328306438165E-10)
260--- testing: 4294967293, 7 ---
261float(2.6959946535332E+67)
262--- testing: 4294967293, 9 ---
263float(4.973232332834E+86)
264--- testing: 4294967293, 65 ---
265float(INF)
266--- testing: 4294967293, -44 ---
267float(0)
268--- testing: 4294967293, 2147483647 ---
269float(INF)
270--- testing: 4294967293, -2147483648 ---
271float(0)
272--- testing: 4294967293, 9223372036854775807 ---
273float(INF)
274--- testing: 4294967293, -9223372036854775808 ---
275float(0)
276--- testing: 9223372036854775806, 0 ---
277int(1)
278--- testing: 9223372036854775806, 1 ---
279int(9223372036854775806)
280--- testing: 9223372036854775806, -1 ---
281float(1.0842021724855E-19)
282--- testing: 9223372036854775806, 7 ---
283float(5.6784275335594E+132)
284--- testing: 9223372036854775806, 9 ---
285float(4.8306719037716E+170)
286--- testing: 9223372036854775806, 65 ---
287float(INF)
288--- testing: 9223372036854775806, -44 ---
289float(0)
290--- testing: 9223372036854775806, 2147483647 ---
291float(INF)
292--- testing: 9223372036854775806, -2147483648 ---
293float(0)
294--- testing: 9223372036854775806, 9223372036854775807 ---
295float(INF)
296--- testing: 9223372036854775806, -9223372036854775808 ---
297float(0)
298--- testing: 9.2233720368548E+18, 0 ---
299float(1)
300--- testing: 9.2233720368548E+18, 1 ---
301float(9.2233720368548E+18)
302--- testing: 9.2233720368548E+18, -1 ---
303float(1.0842021724855E-19)
304--- testing: 9.2233720368548E+18, 7 ---
305float(5.6784275335594E+132)
306--- testing: 9.2233720368548E+18, 9 ---
307float(4.8306719037716E+170)
308--- testing: 9.2233720368548E+18, 65 ---
309float(INF)
310--- testing: 9.2233720368548E+18, -44 ---
311float(0)
312--- testing: 9.2233720368548E+18, 2147483647 ---
313float(INF)
314--- testing: 9.2233720368548E+18, -2147483648 ---
315float(0)
316--- testing: 9.2233720368548E+18, 9223372036854775807 ---
317float(INF)
318--- testing: 9.2233720368548E+18, -9223372036854775808 ---
319float(0)
320--- testing: -9223372036854775807, 0 ---
321int(1)
322--- testing: -9223372036854775807, 1 ---
323int(-9223372036854775807)
324--- testing: -9223372036854775807, -1 ---
325float(-1.0842021724855E-19)
326--- testing: -9223372036854775807, 7 ---
327float(-5.6784275335594E+132)
328--- testing: -9223372036854775807, 9 ---
329float(-4.8306719037716E+170)
330--- testing: -9223372036854775807, 65 ---
331float(-INF)
332--- testing: -9223372036854775807, -44 ---
333float(0)
334--- testing: -9223372036854775807, 2147483647 ---
335float(-INF)
336--- testing: -9223372036854775807, -2147483648 ---
337float(0)
338--- testing: -9223372036854775807, 9223372036854775807 ---
339float(-INF)
340--- testing: -9223372036854775807, -9223372036854775808 ---
341float(0)
342--- testing: -9.2233720368548E+18, 0 ---
343float(1)
344--- testing: -9.2233720368548E+18, 1 ---
345float(-9.2233720368548E+18)
346--- testing: -9.2233720368548E+18, -1 ---
347float(-1.0842021724855E-19)
348--- testing: -9.2233720368548E+18, 7 ---
349float(-5.6784275335594E+132)
350--- testing: -9.2233720368548E+18, 9 ---
351float(-4.8306719037716E+170)
352--- testing: -9.2233720368548E+18, 65 ---
353float(-INF)
354--- testing: -9.2233720368548E+18, -44 ---
355float(0)
356--- testing: -9.2233720368548E+18, 2147483647 ---
357float(-INF)
358--- testing: -9.2233720368548E+18, -2147483648 ---
359float(0)
360--- testing: -9.2233720368548E+18, 9223372036854775807 ---
361float(INF)
362--- testing: -9.2233720368548E+18, -9223372036854775808 ---
363float(0)
364===DONE===
365