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