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