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