1--TEST--
2Test atan2 function : 64bit long tests
3--SKIPIF--
4<?php
5if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
6?>
7--INI--
8serialize_precision=14
9--FILE--
10<?php
11
12define("MAX_64Bit", 9223372036854775807);
13define("MAX_32Bit", 2147483647);
14define("MIN_64Bit", -9223372036854775807 - 1);
15define("MIN_32Bit", -2147483647 - 1);
16
17$longVals = array(
18    MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
19    MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
20    MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
21);
22
23$otherVals = array(0, 1, -1, 7, 9, 65, -44, MAX_32Bit, MIN_32Bit, MAX_64Bit, MIN_64Bit);
24
25
26foreach ($longVals as $longVal) {
27   foreach($otherVals as $otherVal) {
28       echo "--- testing: $longVal, $otherVal ---\n";
29      var_dump(atan2($longVal, $otherVal));
30   }
31}
32
33?>
34--EXPECT--
35--- testing: 9223372036854775807, 0 ---
36float(1.5707963267949)
37--- testing: 9223372036854775807, 1 ---
38float(1.5707963267949)
39--- testing: 9223372036854775807, -1 ---
40float(1.5707963267949)
41--- testing: 9223372036854775807, 7 ---
42float(1.5707963267949)
43--- testing: 9223372036854775807, 9 ---
44float(1.5707963267949)
45--- testing: 9223372036854775807, 65 ---
46float(1.5707963267949)
47--- testing: 9223372036854775807, -44 ---
48float(1.5707963267949)
49--- testing: 9223372036854775807, 2147483647 ---
50float(1.5707963265621)
51--- testing: 9223372036854775807, -2147483648 ---
52float(1.5707963270277)
53--- testing: 9223372036854775807, 9223372036854775807 ---
54float(0.78539816339745)
55--- testing: 9223372036854775807, -9223372036854775808 ---
56float(2.3561944901923)
57--- testing: -9223372036854775808, 0 ---
58float(-1.5707963267949)
59--- testing: -9223372036854775808, 1 ---
60float(-1.5707963267949)
61--- testing: -9223372036854775808, -1 ---
62float(-1.5707963267949)
63--- testing: -9223372036854775808, 7 ---
64float(-1.5707963267949)
65--- testing: -9223372036854775808, 9 ---
66float(-1.5707963267949)
67--- testing: -9223372036854775808, 65 ---
68float(-1.5707963267949)
69--- testing: -9223372036854775808, -44 ---
70float(-1.5707963267949)
71--- testing: -9223372036854775808, 2147483647 ---
72float(-1.5707963265621)
73--- testing: -9223372036854775808, -2147483648 ---
74float(-1.5707963270277)
75--- testing: -9223372036854775808, 9223372036854775807 ---
76float(-0.78539816339745)
77--- testing: -9223372036854775808, -9223372036854775808 ---
78float(-2.3561944901923)
79--- testing: 2147483647, 0 ---
80float(1.5707963267949)
81--- testing: 2147483647, 1 ---
82float(1.5707963263292)
83--- testing: 2147483647, -1 ---
84float(1.5707963272606)
85--- testing: 2147483647, 7 ---
86float(1.5707963235353)
87--- testing: 2147483647, 9 ---
88float(1.5707963226039)
89--- testing: 2147483647, 65 ---
90float(1.5707962965269)
91--- testing: 2147483647, -44 ---
92float(1.570796347284)
93--- testing: 2147483647, 2147483647 ---
94float(0.78539816339745)
95--- testing: 2147483647, -2147483648 ---
96float(2.3561944904252)
97--- testing: 2147483647, 9223372036854775807 ---
98float(2.3283064354545E-10)
99--- testing: 2147483647, -9223372036854775808 ---
100float(3.141592653357)
101--- testing: -2147483648, 0 ---
102float(-1.5707963267949)
103--- testing: -2147483648, 1 ---
104float(-1.5707963263292)
105--- testing: -2147483648, -1 ---
106float(-1.5707963272606)
107--- testing: -2147483648, 7 ---
108float(-1.5707963235353)
109--- testing: -2147483648, 9 ---
110float(-1.5707963226039)
111--- testing: -2147483648, 65 ---
112float(-1.5707962965269)
113--- testing: -2147483648, -44 ---
114float(-1.570796347284)
115--- testing: -2147483648, 2147483647 ---
116float(-0.78539816363028)
117--- testing: -2147483648, -2147483648 ---
118float(-2.3561944901923)
119--- testing: -2147483648, 9223372036854775807 ---
120float(-2.3283064365387E-10)
121--- testing: -2147483648, -9223372036854775808 ---
122float(-3.141592653357)
123--- testing: 9223372034707292160, 0 ---
124float(1.5707963267949)
125--- testing: 9223372034707292160, 1 ---
126float(1.5707963267949)
127--- testing: 9223372034707292160, -1 ---
128float(1.5707963267949)
129--- testing: 9223372034707292160, 7 ---
130float(1.5707963267949)
131--- testing: 9223372034707292160, 9 ---
132float(1.5707963267949)
133--- testing: 9223372034707292160, 65 ---
134float(1.5707963267949)
135--- testing: 9223372034707292160, -44 ---
136float(1.5707963267949)
137--- testing: 9223372034707292160, 2147483647 ---
138float(1.5707963265621)
139--- testing: 9223372034707292160, -2147483648 ---
140float(1.5707963270277)
141--- testing: 9223372034707292160, 9223372036854775807 ---
142float(0.78539816328103)
143--- testing: 9223372034707292160, -9223372036854775808 ---
144float(2.3561944903088)
145--- testing: -9223372034707292160, 0 ---
146float(-1.5707963267949)
147--- testing: -9223372034707292160, 1 ---
148float(-1.5707963267949)
149--- testing: -9223372034707292160, -1 ---
150float(-1.5707963267949)
151--- testing: -9223372034707292160, 7 ---
152float(-1.5707963267949)
153--- testing: -9223372034707292160, 9 ---
154float(-1.5707963267949)
155--- testing: -9223372034707292160, 65 ---
156float(-1.5707963267949)
157--- testing: -9223372034707292160, -44 ---
158float(-1.5707963267949)
159--- testing: -9223372034707292160, 2147483647 ---
160float(-1.5707963265621)
161--- testing: -9223372034707292160, -2147483648 ---
162float(-1.5707963270277)
163--- testing: -9223372034707292160, 9223372036854775807 ---
164float(-0.78539816328103)
165--- testing: -9223372034707292160, -9223372036854775808 ---
166float(-2.3561944903088)
167--- testing: 2147483648, 0 ---
168float(1.5707963267949)
169--- testing: 2147483648, 1 ---
170float(1.5707963263292)
171--- testing: 2147483648, -1 ---
172float(1.5707963272606)
173--- testing: 2147483648, 7 ---
174float(1.5707963235353)
175--- testing: 2147483648, 9 ---
176float(1.5707963226039)
177--- testing: 2147483648, 65 ---
178float(1.5707962965269)
179--- testing: 2147483648, -44 ---
180float(1.570796347284)
181--- testing: 2147483648, 2147483647 ---
182float(0.78539816363028)
183--- testing: 2147483648, -2147483648 ---
184float(2.3561944901923)
185--- testing: 2147483648, 9223372036854775807 ---
186float(2.3283064365387E-10)
187--- testing: 2147483648, -9223372036854775808 ---
188float(3.141592653357)
189--- testing: -2147483649, 0 ---
190float(-1.5707963267949)
191--- testing: -2147483649, 1 ---
192float(-1.5707963263292)
193--- testing: -2147483649, -1 ---
194float(-1.5707963272606)
195--- testing: -2147483649, 7 ---
196float(-1.5707963235353)
197--- testing: -2147483649, 9 ---
198float(-1.5707963226039)
199--- testing: -2147483649, 65 ---
200float(-1.5707962965269)
201--- testing: -2147483649, -44 ---
202float(-1.570796347284)
203--- testing: -2147483649, 2147483647 ---
204float(-0.78539816386311)
205--- testing: -2147483649, -2147483648 ---
206float(-2.3561944899595)
207--- testing: -2147483649, 9223372036854775807 ---
208float(-2.3283064376229E-10)
209--- testing: -2147483649, -9223372036854775808 ---
210float(-3.141592653357)
211--- testing: 4294967294, 0 ---
212float(1.5707963267949)
213--- testing: 4294967294, 1 ---
214float(1.5707963265621)
215--- testing: 4294967294, -1 ---
216float(1.5707963270277)
217--- testing: 4294967294, 7 ---
218float(1.5707963251651)
219--- testing: 4294967294, 9 ---
220float(1.5707963246994)
221--- testing: 4294967294, 65 ---
222float(1.5707963116609)
223--- testing: 4294967294, -44 ---
224float(1.5707963370394)
225--- testing: 4294967294, 2147483647 ---
226float(1.1071487177941)
227--- testing: 4294967294, -2147483648 ---
228float(2.034443935982)
229--- testing: 4294967294, 9223372036854775807 ---
230float(4.656612870909E-10)
231--- testing: 4294967294, -9223372036854775808 ---
232float(3.1415926531241)
233--- testing: 4294967295, 0 ---
234float(1.5707963267949)
235--- testing: 4294967295, 1 ---
236float(1.5707963265621)
237--- testing: 4294967295, -1 ---
238float(1.5707963270277)
239--- testing: 4294967295, 7 ---
240float(1.5707963251651)
241--- testing: 4294967295, 9 ---
242float(1.5707963246994)
243--- testing: 4294967295, 65 ---
244float(1.5707963116609)
245--- testing: 4294967295, -44 ---
246float(1.5707963370394)
247--- testing: 4294967295, 2147483647 ---
248float(1.1071487178872)
249--- testing: 4294967295, -2147483648 ---
250float(2.0344439358888)
251--- testing: 4294967295, 9223372036854775807 ---
252float(4.6566128719932E-10)
253--- testing: 4294967295, -9223372036854775808 ---
254float(3.1415926531241)
255--- testing: 4294967293, 0 ---
256float(1.5707963267949)
257--- testing: 4294967293, 1 ---
258float(1.5707963265621)
259--- testing: 4294967293, -1 ---
260float(1.5707963270277)
261--- testing: 4294967293, 7 ---
262float(1.5707963251651)
263--- testing: 4294967293, 9 ---
264float(1.5707963246994)
265--- testing: 4294967293, 65 ---
266float(1.5707963116609)
267--- testing: 4294967293, -44 ---
268float(1.5707963370394)
269--- testing: 4294967293, 2147483647 ---
270float(1.107148717701)
271--- testing: 4294967293, -2147483648 ---
272float(2.0344439360751)
273--- testing: 4294967293, 9223372036854775807 ---
274float(4.6566128698248E-10)
275--- testing: 4294967293, -9223372036854775808 ---
276float(3.1415926531241)
277--- testing: 9223372036854775806, 0 ---
278float(1.5707963267949)
279--- testing: 9223372036854775806, 1 ---
280float(1.5707963267949)
281--- testing: 9223372036854775806, -1 ---
282float(1.5707963267949)
283--- testing: 9223372036854775806, 7 ---
284float(1.5707963267949)
285--- testing: 9223372036854775806, 9 ---
286float(1.5707963267949)
287--- testing: 9223372036854775806, 65 ---
288float(1.5707963267949)
289--- testing: 9223372036854775806, -44 ---
290float(1.5707963267949)
291--- testing: 9223372036854775806, 2147483647 ---
292float(1.5707963265621)
293--- testing: 9223372036854775806, -2147483648 ---
294float(1.5707963270277)
295--- testing: 9223372036854775806, 9223372036854775807 ---
296float(0.78539816339745)
297--- testing: 9223372036854775806, -9223372036854775808 ---
298float(2.3561944901923)
299--- testing: 9.2233720368548E+18, 0 ---
300float(1.5707963267949)
301--- testing: 9.2233720368548E+18, 1 ---
302float(1.5707963267949)
303--- testing: 9.2233720368548E+18, -1 ---
304float(1.5707963267949)
305--- testing: 9.2233720368548E+18, 7 ---
306float(1.5707963267949)
307--- testing: 9.2233720368548E+18, 9 ---
308float(1.5707963267949)
309--- testing: 9.2233720368548E+18, 65 ---
310float(1.5707963267949)
311--- testing: 9.2233720368548E+18, -44 ---
312float(1.5707963267949)
313--- testing: 9.2233720368548E+18, 2147483647 ---
314float(1.5707963265621)
315--- testing: 9.2233720368548E+18, -2147483648 ---
316float(1.5707963270277)
317--- testing: 9.2233720368548E+18, 9223372036854775807 ---
318float(0.78539816339745)
319--- testing: 9.2233720368548E+18, -9223372036854775808 ---
320float(2.3561944901923)
321--- testing: -9223372036854775807, 0 ---
322float(-1.5707963267949)
323--- testing: -9223372036854775807, 1 ---
324float(-1.5707963267949)
325--- testing: -9223372036854775807, -1 ---
326float(-1.5707963267949)
327--- testing: -9223372036854775807, 7 ---
328float(-1.5707963267949)
329--- testing: -9223372036854775807, 9 ---
330float(-1.5707963267949)
331--- testing: -9223372036854775807, 65 ---
332float(-1.5707963267949)
333--- testing: -9223372036854775807, -44 ---
334float(-1.5707963267949)
335--- testing: -9223372036854775807, 2147483647 ---
336float(-1.5707963265621)
337--- testing: -9223372036854775807, -2147483648 ---
338float(-1.5707963270277)
339--- testing: -9223372036854775807, 9223372036854775807 ---
340float(-0.78539816339745)
341--- testing: -9223372036854775807, -9223372036854775808 ---
342float(-2.3561944901923)
343--- testing: -9.2233720368548E+18, 0 ---
344float(-1.5707963267949)
345--- testing: -9.2233720368548E+18, 1 ---
346float(-1.5707963267949)
347--- testing: -9.2233720368548E+18, -1 ---
348float(-1.5707963267949)
349--- testing: -9.2233720368548E+18, 7 ---
350float(-1.5707963267949)
351--- testing: -9.2233720368548E+18, 9 ---
352float(-1.5707963267949)
353--- testing: -9.2233720368548E+18, 65 ---
354float(-1.5707963267949)
355--- testing: -9.2233720368548E+18, -44 ---
356float(-1.5707963267949)
357--- testing: -9.2233720368548E+18, 2147483647 ---
358float(-1.5707963265621)
359--- testing: -9.2233720368548E+18, -2147483648 ---
360float(-1.5707963270277)
361--- testing: -9.2233720368548E+18, 9223372036854775807 ---
362float(-0.78539816339745)
363--- testing: -9.2233720368548E+18, -9223372036854775808 ---
364float(-2.3561944901923)
365