d474c395730a8fd07329fe940ec3a0c698f8e2c1
[gcc.git] /
1 // 2007-02-04 Edward Smith-Rowland <3dw4rd@verizon.net>
2 //
3 // Copyright (C) 2007-2016 Free Software Foundation, Inc.
4 //
5 // This file is part of the GNU ISO C++ Library. This library is free
6 // software; you can redistribute it and/or modify it under the
7 // terms of the GNU General Public License as published by the
8 // Free Software Foundation; either version 3, or (at your option)
9 // any later version.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License along
17 // with this library; see the file COPYING3. If not see
18 // <http://www.gnu.org/licenses/>.
19
20 // assoc_legendre
21
22
23 // Compare against values generated by the GNU Scientific Library.
24 // The GSL can be found on the web: http://www.gnu.org/software/gsl/
25
26 #include <tr1/cmath>
27 #if defined(__TEST_DEBUG)
28 #include <iostream>
29 #define VERIFY(A) \
30 if (!(A)) \
31 { \
32 std::cout << "line " << __LINE__ \
33 << " max_abs_frac = " << max_abs_frac \
34 << std::endl; \
35 }
36 #else
37 #include <testsuite_hooks.h>
38 #endif
39 #include "../testcase.h"
40
41
42 // Test data for l=0, m=0.
43 testcase_assoc_legendre<double> data001[] = {
44 { 1.0000000000000000, 0, 0,
45 -1.0000000000000000 },
46 { 1.0000000000000000, 0, 0,
47 -0.90000000000000002 },
48 { 1.0000000000000000, 0, 0,
49 -0.80000000000000004 },
50 { 1.0000000000000000, 0, 0,
51 -0.69999999999999996 },
52 { 1.0000000000000000, 0, 0,
53 -0.59999999999999998 },
54 { 1.0000000000000000, 0, 0,
55 -0.50000000000000000 },
56 { 1.0000000000000000, 0, 0,
57 -0.40000000000000002 },
58 { 1.0000000000000000, 0, 0,
59 -0.30000000000000004 },
60 { 1.0000000000000000, 0, 0,
61 -0.19999999999999996 },
62 { 1.0000000000000000, 0, 0,
63 -0.099999999999999978 },
64 { 1.0000000000000000, 0, 0,
65 0.0000000000000000 },
66 { 1.0000000000000000, 0, 0,
67 0.10000000000000009 },
68 { 1.0000000000000000, 0, 0,
69 0.19999999999999996 },
70 { 1.0000000000000000, 0, 0,
71 0.30000000000000004 },
72 { 1.0000000000000000, 0, 0,
73 0.39999999999999991 },
74 { 1.0000000000000000, 0, 0,
75 0.50000000000000000 },
76 { 1.0000000000000000, 0, 0,
77 0.60000000000000009 },
78 { 1.0000000000000000, 0, 0,
79 0.69999999999999996 },
80 { 1.0000000000000000, 0, 0,
81 0.80000000000000004 },
82 { 1.0000000000000000, 0, 0,
83 0.89999999999999991 },
84 { 1.0000000000000000, 0, 0,
85 1.0000000000000000 },
86 };
87
88 // Test function for l=0, m=0.
89 template <typename Tp>
90 void test001()
91 {
92 const Tp eps = std::numeric_limits<Tp>::epsilon();
93 Tp max_abs_diff = -Tp(1);
94 Tp max_abs_frac = -Tp(1);
95 unsigned int num_datum = sizeof(data001)
96 / sizeof(testcase_assoc_legendre<double>);
97 for (unsigned int i = 0; i < num_datum; ++i)
98 {
99 const Tp f = std::tr1::assoc_legendre(Tp(data001[i].l), Tp(data001[i].m),
100 Tp(data001[i].x));
101 const Tp f0 = data001[i].f0;
102 const Tp diff = f - f0;
103 if (std::abs(diff) > max_abs_diff)
104 max_abs_diff = std::abs(diff);
105 if (std::abs(f0) > Tp(10) * eps
106 && std::abs(f) > Tp(10) * eps)
107 {
108 const Tp frac = diff / f0;
109 if (std::abs(frac) > max_abs_frac)
110 max_abs_frac = std::abs(frac);
111 }
112 }
113 VERIFY(max_abs_frac < Tp(2.5000000000000020e-13));
114 }
115
116 // Test data for l=1, m=0.
117 testcase_assoc_legendre<double> data002[] = {
118 { -1.0000000000000000, 1, 0,
119 -1.0000000000000000 },
120 { -0.90000000000000002, 1, 0,
121 -0.90000000000000002 },
122 { -0.80000000000000004, 1, 0,
123 -0.80000000000000004 },
124 { -0.69999999999999996, 1, 0,
125 -0.69999999999999996 },
126 { -0.59999999999999998, 1, 0,
127 -0.59999999999999998 },
128 { -0.50000000000000000, 1, 0,
129 -0.50000000000000000 },
130 { -0.40000000000000002, 1, 0,
131 -0.40000000000000002 },
132 { -0.30000000000000004, 1, 0,
133 -0.30000000000000004 },
134 { -0.19999999999999996, 1, 0,
135 -0.19999999999999996 },
136 { -0.099999999999999978, 1, 0,
137 -0.099999999999999978 },
138 { 0.0000000000000000, 1, 0,
139 0.0000000000000000 },
140 { 0.10000000000000009, 1, 0,
141 0.10000000000000009 },
142 { 0.19999999999999996, 1, 0,
143 0.19999999999999996 },
144 { 0.30000000000000004, 1, 0,
145 0.30000000000000004 },
146 { 0.39999999999999991, 1, 0,
147 0.39999999999999991 },
148 { 0.50000000000000000, 1, 0,
149 0.50000000000000000 },
150 { 0.60000000000000009, 1, 0,
151 0.60000000000000009 },
152 { 0.69999999999999996, 1, 0,
153 0.69999999999999996 },
154 { 0.80000000000000004, 1, 0,
155 0.80000000000000004 },
156 { 0.89999999999999991, 1, 0,
157 0.89999999999999991 },
158 { 1.0000000000000000, 1, 0,
159 1.0000000000000000 },
160 };
161
162 // Test function for l=1, m=0.
163 template <typename Tp>
164 void test002()
165 {
166 const Tp eps = std::numeric_limits<Tp>::epsilon();
167 Tp max_abs_diff = -Tp(1);
168 Tp max_abs_frac = -Tp(1);
169 unsigned int num_datum = sizeof(data002)
170 / sizeof(testcase_assoc_legendre<double>);
171 for (unsigned int i = 0; i < num_datum; ++i)
172 {
173 const Tp f = std::tr1::assoc_legendre(Tp(data002[i].l), Tp(data002[i].m),
174 Tp(data002[i].x));
175 const Tp f0 = data002[i].f0;
176 const Tp diff = f - f0;
177 if (std::abs(diff) > max_abs_diff)
178 max_abs_diff = std::abs(diff);
179 if (std::abs(f0) > Tp(10) * eps
180 && std::abs(f) > Tp(10) * eps)
181 {
182 const Tp frac = diff / f0;
183 if (std::abs(frac) > max_abs_frac)
184 max_abs_frac = std::abs(frac);
185 }
186 }
187 VERIFY(max_abs_frac < Tp(2.5000000000000020e-13));
188 }
189
190 // Test data for l=1, m=1.
191 testcase_assoc_legendre<double> data003[] = {
192 { -0.0000000000000000, 1, 1,
193 -1.0000000000000000 },
194 { -0.43588989435406728, 1, 1,
195 -0.90000000000000002 },
196 { -0.59999999999999987, 1, 1,
197 -0.80000000000000004 },
198 { -0.71414284285428509, 1, 1,
199 -0.69999999999999996 },
200 { -0.80000000000000004, 1, 1,
201 -0.59999999999999998 },
202 { -0.86602540378443860, 1, 1,
203 -0.50000000000000000 },
204 { -0.91651513899116799, 1, 1,
205 -0.40000000000000002 },
206 { -0.95393920141694577, 1, 1,
207 -0.30000000000000004 },
208 { -0.97979589711327120, 1, 1,
209 -0.19999999999999996 },
210 { -0.99498743710661997, 1, 1,
211 -0.099999999999999978 },
212 { -1.0000000000000000, 1, 1,
213 0.0000000000000000 },
214 { -0.99498743710661997, 1, 1,
215 0.10000000000000009 },
216 { -0.97979589711327120, 1, 1,
217 0.19999999999999996 },
218 { -0.95393920141694577, 1, 1,
219 0.30000000000000004 },
220 { -0.91651513899116799, 1, 1,
221 0.39999999999999991 },
222 { -0.86602540378443860, 1, 1,
223 0.50000000000000000 },
224 { -0.79999999999999993, 1, 1,
225 0.60000000000000009 },
226 { -0.71414284285428509, 1, 1,
227 0.69999999999999996 },
228 { -0.59999999999999987, 1, 1,
229 0.80000000000000004 },
230 { -0.43588989435406750, 1, 1,
231 0.89999999999999991 },
232 { -0.0000000000000000, 1, 1,
233 1.0000000000000000 },
234 };
235
236 // Test function for l=1, m=1.
237 template <typename Tp>
238 void test003()
239 {
240 const Tp eps = std::numeric_limits<Tp>::epsilon();
241 Tp max_abs_diff = -Tp(1);
242 Tp max_abs_frac = -Tp(1);
243 unsigned int num_datum = sizeof(data003)
244 / sizeof(testcase_assoc_legendre<double>);
245 for (unsigned int i = 0; i < num_datum; ++i)
246 {
247 const Tp f = std::tr1::assoc_legendre(Tp(data003[i].l), Tp(data003[i].m),
248 Tp(data003[i].x));
249 const Tp f0 = data003[i].f0;
250 const Tp diff = f - f0;
251 if (std::abs(diff) > max_abs_diff)
252 max_abs_diff = std::abs(diff);
253 if (std::abs(f0) > Tp(10) * eps
254 && std::abs(f) > Tp(10) * eps)
255 {
256 const Tp frac = diff / f0;
257 if (std::abs(frac) > max_abs_frac)
258 max_abs_frac = std::abs(frac);
259 }
260 }
261 VERIFY(max_abs_frac < Tp(2.5000000000000020e-13));
262 }
263
264 // Test data for l=2, m=0.
265 testcase_assoc_legendre<double> data004[] = {
266 { 1.0000000000000000, 2, 0,
267 -1.0000000000000000 },
268 { 0.71500000000000008, 2, 0,
269 -0.90000000000000002 },
270 { 0.46000000000000019, 2, 0,
271 -0.80000000000000004 },
272 { 0.23499999999999982, 2, 0,
273 -0.69999999999999996 },
274 { 0.039999999999999925, 2, 0,
275 -0.59999999999999998 },
276 { -0.12500000000000000, 2, 0,
277 -0.50000000000000000 },
278 { -0.25999999999999995, 2, 0,
279 -0.40000000000000002 },
280 { -0.36499999999999994, 2, 0,
281 -0.30000000000000004 },
282 { -0.44000000000000000, 2, 0,
283 -0.19999999999999996 },
284 { -0.48499999999999999, 2, 0,
285 -0.099999999999999978 },
286 { -0.50000000000000000, 2, 0,
287 0.0000000000000000 },
288 { -0.48499999999999999, 2, 0,
289 0.10000000000000009 },
290 { -0.44000000000000000, 2, 0,
291 0.19999999999999996 },
292 { -0.36499999999999994, 2, 0,
293 0.30000000000000004 },
294 { -0.26000000000000012, 2, 0,
295 0.39999999999999991 },
296 { -0.12500000000000000, 2, 0,
297 0.50000000000000000 },
298 { 0.040000000000000160, 2, 0,
299 0.60000000000000009 },
300 { 0.23499999999999982, 2, 0,
301 0.69999999999999996 },
302 { 0.46000000000000019, 2, 0,
303 0.80000000000000004 },
304 { 0.71499999999999975, 2, 0,
305 0.89999999999999991 },
306 { 1.0000000000000000, 2, 0,
307 1.0000000000000000 },
308 };
309
310 // Test function for l=2, m=0.
311 template <typename Tp>
312 void test004()
313 {
314 const Tp eps = std::numeric_limits<Tp>::epsilon();
315 Tp max_abs_diff = -Tp(1);
316 Tp max_abs_frac = -Tp(1);
317 unsigned int num_datum = sizeof(data004)
318 / sizeof(testcase_assoc_legendre<double>);
319 for (unsigned int i = 0; i < num_datum; ++i)
320 {
321 const Tp f = std::tr1::assoc_legendre(Tp(data004[i].l), Tp(data004[i].m),
322 Tp(data004[i].x));
323 const Tp f0 = data004[i].f0;
324 const Tp diff = f - f0;
325 if (std::abs(diff) > max_abs_diff)
326 max_abs_diff = std::abs(diff);
327 if (std::abs(f0) > Tp(10) * eps
328 && std::abs(f) > Tp(10) * eps)
329 {
330 const Tp frac = diff / f0;
331 if (std::abs(frac) > max_abs_frac)
332 max_abs_frac = std::abs(frac);
333 }
334 }
335 VERIFY(max_abs_frac < Tp(2.5000000000000020e-13));
336 }
337
338 // Test data for l=2, m=1.
339 testcase_assoc_legendre<double> data005[] = {
340 { 0.0000000000000000, 2, 1,
341 -1.0000000000000000 },
342 { 1.1769027147559816, 2, 1,
343 -0.90000000000000002 },
344 { 1.4399999999999999, 2, 1,
345 -0.80000000000000004 },
346 { 1.4996999699939983, 2, 1,
347 -0.69999999999999996 },
348 { 1.4399999999999999, 2, 1,
349 -0.59999999999999998 },
350 { 1.2990381056766580, 2, 1,
351 -0.50000000000000000 },
352 { 1.0998181667894018, 2, 1,
353 -0.40000000000000002 },
354 { 0.85854528127525132, 2, 1,
355 -0.30000000000000004 },
356 { 0.58787753826796263, 2, 1,
357 -0.19999999999999996 },
358 { 0.29849623113198592, 2, 1,
359 -0.099999999999999978 },
360 { -0.0000000000000000, 2, 1,
361 0.0000000000000000 },
362 { -0.29849623113198626, 2, 1,
363 0.10000000000000009 },
364 { -0.58787753826796263, 2, 1,
365 0.19999999999999996 },
366 { -0.85854528127525132, 2, 1,
367 0.30000000000000004 },
368 { -1.0998181667894014, 2, 1,
369 0.39999999999999991 },
370 { -1.2990381056766580, 2, 1,
371 0.50000000000000000 },
372 { -1.4400000000000002, 2, 1,
373 0.60000000000000009 },
374 { -1.4996999699939983, 2, 1,
375 0.69999999999999996 },
376 { -1.4399999999999999, 2, 1,
377 0.80000000000000004 },
378 { -1.1769027147559821, 2, 1,
379 0.89999999999999991 },
380 { -0.0000000000000000, 2, 1,
381 1.0000000000000000 },
382 };
383
384 // Test function for l=2, m=1.
385 template <typename Tp>
386 void test005()
387 {
388 const Tp eps = std::numeric_limits<Tp>::epsilon();
389 Tp max_abs_diff = -Tp(1);
390 Tp max_abs_frac = -Tp(1);
391 unsigned int num_datum = sizeof(data005)
392 / sizeof(testcase_assoc_legendre<double>);
393 for (unsigned int i = 0; i < num_datum; ++i)
394 {
395 const Tp f = std::tr1::assoc_legendre(Tp(data005[i].l), Tp(data005[i].m),
396 Tp(data005[i].x));
397 const Tp f0 = data005[i].f0;
398 const Tp diff = f - f0;
399 if (std::abs(diff) > max_abs_diff)
400 max_abs_diff = std::abs(diff);
401 if (std::abs(f0) > Tp(10) * eps
402 && std::abs(f) > Tp(10) * eps)
403 {
404 const Tp frac = diff / f0;
405 if (std::abs(frac) > max_abs_frac)
406 max_abs_frac = std::abs(frac);
407 }
408 }
409 VERIFY(max_abs_frac < Tp(2.5000000000000020e-13));
410 }
411
412 // Test data for l=2, m=2.
413 testcase_assoc_legendre<double> data006[] = {
414 { 0.0000000000000000, 2, 2,
415 -1.0000000000000000 },
416 { 0.56999999999999984, 2, 2,
417 -0.90000000000000002 },
418 { 1.0799999999999996, 2, 2,
419 -0.80000000000000004 },
420 { 1.5300000000000005, 2, 2,
421 -0.69999999999999996 },
422 { 1.9200000000000004, 2, 2,
423 -0.59999999999999998 },
424 { 2.2500000000000000, 2, 2,
425 -0.50000000000000000 },
426 { 2.5200000000000000, 2, 2,
427 -0.40000000000000002 },
428 { 2.7300000000000004, 2, 2,
429 -0.30000000000000004 },
430 { 2.8799999999999999, 2, 2,
431 -0.19999999999999996 },
432 { 2.9700000000000002, 2, 2,
433 -0.099999999999999978 },
434 { 3.0000000000000000, 2, 2,
435 0.0000000000000000 },
436 { 2.9700000000000002, 2, 2,
437 0.10000000000000009 },
438 { 2.8799999999999999, 2, 2,
439 0.19999999999999996 },
440 { 2.7300000000000004, 2, 2,
441 0.30000000000000004 },
442 { 2.5200000000000000, 2, 2,
443 0.39999999999999991 },
444 { 2.2500000000000000, 2, 2,
445 0.50000000000000000 },
446 { 1.9199999999999997, 2, 2,
447 0.60000000000000009 },
448 { 1.5300000000000005, 2, 2,
449 0.69999999999999996 },
450 { 1.0799999999999996, 2, 2,
451 0.80000000000000004 },
452 { 0.57000000000000040, 2, 2,
453 0.89999999999999991 },
454 { 0.0000000000000000, 2, 2,
455 1.0000000000000000 },
456 };
457
458 // Test function for l=2, m=2.
459 template <typename Tp>
460 void test006()
461 {
462 const Tp eps = std::numeric_limits<Tp>::epsilon();
463 Tp max_abs_diff = -Tp(1);
464 Tp max_abs_frac = -Tp(1);
465 unsigned int num_datum = sizeof(data006)
466 / sizeof(testcase_assoc_legendre<double>);
467 for (unsigned int i = 0; i < num_datum; ++i)
468 {
469 const Tp f = std::tr1::assoc_legendre(Tp(data006[i].l), Tp(data006[i].m),
470 Tp(data006[i].x));
471 const Tp f0 = data006[i].f0;
472 const Tp diff = f - f0;
473 if (std::abs(diff) > max_abs_diff)
474 max_abs_diff = std::abs(diff);
475 if (std::abs(f0) > Tp(10) * eps
476 && std::abs(f) > Tp(10) * eps)
477 {
478 const Tp frac = diff / f0;
479 if (std::abs(frac) > max_abs_frac)
480 max_abs_frac = std::abs(frac);
481 }
482 }
483 VERIFY(max_abs_frac < Tp(2.5000000000000020e-13));
484 }
485
486 // Test data for l=5, m=0.
487 testcase_assoc_legendre<double> data007[] = {
488 { -1.0000000000000000, 5, 0,
489 -1.0000000000000000 },
490 { 0.041141249999999997, 5, 0,
491 -0.90000000000000002 },
492 { 0.39951999999999993, 5, 0,
493 -0.80000000000000004 },
494 { 0.36519874999999991, 5, 0,
495 -0.69999999999999996 },
496 { 0.15263999999999994, 5, 0,
497 -0.59999999999999998 },
498 { -0.089843750000000000, 5, 0,
499 -0.50000000000000000 },
500 { -0.27063999999999988, 5, 0,
501 -0.40000000000000002 },
502 { -0.34538624999999995, 5, 0,
503 -0.30000000000000004 },
504 { -0.30751999999999996, 5, 0,
505 -0.19999999999999996 },
506 { -0.17882874999999995, 5, 0,
507 -0.099999999999999978 },
508 { 0.0000000000000000, 5, 0,
509 0.0000000000000000 },
510 { 0.17882875000000015, 5, 0,
511 0.10000000000000009 },
512 { 0.30751999999999996, 5, 0,
513 0.19999999999999996 },
514 { 0.34538624999999995, 5, 0,
515 0.30000000000000004 },
516 { 0.27064000000000010, 5, 0,
517 0.39999999999999991 },
518 { 0.089843750000000000, 5, 0,
519 0.50000000000000000 },
520 { -0.15264000000000022, 5, 0,
521 0.60000000000000009 },
522 { -0.36519874999999991, 5, 0,
523 0.69999999999999996 },
524 { -0.39951999999999993, 5, 0,
525 0.80000000000000004 },
526 { -0.041141250000000407, 5, 0,
527 0.89999999999999991 },
528 { 1.0000000000000000, 5, 0,
529 1.0000000000000000 },
530 };
531
532 // Test function for l=5, m=0.
533 template <typename Tp>
534 void test007()
535 {
536 const Tp eps = std::numeric_limits<Tp>::epsilon();
537 Tp max_abs_diff = -Tp(1);
538 Tp max_abs_frac = -Tp(1);
539 unsigned int num_datum = sizeof(data007)
540 / sizeof(testcase_assoc_legendre<double>);
541 for (unsigned int i = 0; i < num_datum; ++i)
542 {
543 const Tp f = std::tr1::assoc_legendre(Tp(data007[i].l), Tp(data007[i].m),
544 Tp(data007[i].x));
545 const Tp f0 = data007[i].f0;
546 const Tp diff = f - f0;
547 if (std::abs(diff) > max_abs_diff)
548 max_abs_diff = std::abs(diff);
549 if (std::abs(f0) > Tp(10) * eps
550 && std::abs(f) > Tp(10) * eps)
551 {
552 const Tp frac = diff / f0;
553 if (std::abs(frac) > max_abs_frac)
554 max_abs_frac = std::abs(frac);
555 }
556 }
557 VERIFY(max_abs_frac < Tp(2.5000000000000020e-13));
558 }
559
560 // Test data for l=5, m=1.
561 testcase_assoc_legendre<double> data008[] = {
562 { 0.0000000000000000, 5, 1,
563 -1.0000000000000000 },
564 { -2.8099369608350973, 5, 1,
565 -0.90000000000000002 },
566 { -0.72180000000000089, 5, 1,
567 -0.80000000000000004 },
568 { 1.0951826834447254, 5, 1,
569 -0.69999999999999996 },
570 { 1.9775999999999998, 5, 1,
571 -0.59999999999999998 },
572 { 1.9282596881137892, 5, 1,
573 -0.50000000000000000 },
574 { 1.2070504380513685, 5, 1,
575 -0.40000000000000002 },
576 { 0.16079837663884430, 5, 1,
577 -0.30000000000000004 },
578 { -0.87005875663658538, 5, 1,
579 -0.19999999999999996 },
580 { -1.6083350053680323, 5, 1,
581 -0.099999999999999978 },
582 { -1.8750000000000000, 5, 1,
583 0.0000000000000000 },
584 { -1.6083350053680314, 5, 1,
585 0.10000000000000009 },
586 { -0.87005875663658538, 5, 1,
587 0.19999999999999996 },
588 { 0.16079837663884430, 5, 1,
589 0.30000000000000004 },
590 { 1.2070504380513674, 5, 1,
591 0.39999999999999991 },
592 { 1.9282596881137892, 5, 1,
593 0.50000000000000000 },
594 { 1.9775999999999996, 5, 1,
595 0.60000000000000009 },
596 { 1.0951826834447254, 5, 1,
597 0.69999999999999996 },
598 { -0.72180000000000089, 5, 1,
599 0.80000000000000004 },
600 { -2.8099369608350959, 5, 1,
601 0.89999999999999991 },
602 { 0.0000000000000000, 5, 1,
603 1.0000000000000000 },
604 };
605
606 // Test function for l=5, m=1.
607 template <typename Tp>
608 void test008()
609 {
610 const Tp eps = std::numeric_limits<Tp>::epsilon();
611 Tp max_abs_diff = -Tp(1);
612 Tp max_abs_frac = -Tp(1);
613 unsigned int num_datum = sizeof(data008)
614 / sizeof(testcase_assoc_legendre<double>);
615 for (unsigned int i = 0; i < num_datum; ++i)
616 {
617 const Tp f = std::tr1::assoc_legendre(Tp(data008[i].l), Tp(data008[i].m),
618 Tp(data008[i].x));
619 const Tp f0 = data008[i].f0;
620 const Tp diff = f - f0;
621 if (std::abs(diff) > max_abs_diff)
622 max_abs_diff = std::abs(diff);
623 if (std::abs(f0) > Tp(10) * eps
624 && std::abs(f) > Tp(10) * eps)
625 {
626 const Tp frac = diff / f0;
627 if (std::abs(frac) > max_abs_frac)
628 max_abs_frac = std::abs(frac);
629 }
630 }
631 VERIFY(max_abs_frac < Tp(2.5000000000000020e-13));
632 }
633
634 // Test data for l=5, m=2.
635 testcase_assoc_legendre<double> data009[] = {
636 { 0.0000000000000000, 5, 2,
637 -1.0000000000000000 },
638 { -12.837824999999995, 5, 2,
639 -0.90000000000000002 },
640 { -13.910399999999997, 5, 2,
641 -0.80000000000000004 },
642 { -8.8089749999999984, 5, 2,
643 -0.69999999999999996 },
644 { -1.6128000000000009, 5, 2,
645 -0.59999999999999998 },
646 { 4.9218750000000000, 5, 2,
647 -0.50000000000000000 },
648 { 9.1728000000000005, 5, 2,
649 -0.40000000000000002 },
650 { 10.462725000000001, 5, 2,
651 -0.30000000000000004 },
652 { 8.8703999999999983, 5, 2,
653 -0.19999999999999996 },
654 { 5.0415749999999999, 5, 2,
655 -0.099999999999999978 },
656 { -0.0000000000000000, 5, 2,
657 0.0000000000000000 },
658 { -5.0415750000000044, 5, 2,
659 0.10000000000000009 },
660 { -8.8703999999999983, 5, 2,
661 0.19999999999999996 },
662 { -10.462725000000001, 5, 2,
663 0.30000000000000004 },
664 { -9.1728000000000005, 5, 2,
665 0.39999999999999991 },
666 { -4.9218750000000000, 5, 2,
667 0.50000000000000000 },
668 { 1.6128000000000071, 5, 2,
669 0.60000000000000009 },
670 { 8.8089749999999984, 5, 2,
671 0.69999999999999996 },
672 { 13.910399999999997, 5, 2,
673 0.80000000000000004 },
674 { 12.837825000000004, 5, 2,
675 0.89999999999999991 },
676 { 0.0000000000000000, 5, 2,
677 1.0000000000000000 },
678 };
679
680 // Test function for l=5, m=2.
681 template <typename Tp>
682 void test009()
683 {
684 const Tp eps = std::numeric_limits<Tp>::epsilon();
685 Tp max_abs_diff = -Tp(1);
686 Tp max_abs_frac = -Tp(1);
687 unsigned int num_datum = sizeof(data009)
688 / sizeof(testcase_assoc_legendre<double>);
689 for (unsigned int i = 0; i < num_datum; ++i)
690 {
691 const Tp f = std::tr1::assoc_legendre(Tp(data009[i].l), Tp(data009[i].m),
692 Tp(data009[i].x));
693 const Tp f0 = data009[i].f0;
694 const Tp diff = f - f0;
695 if (std::abs(diff) > max_abs_diff)
696 max_abs_diff = std::abs(diff);
697 if (std::abs(f0) > Tp(10) * eps
698 && std::abs(f) > Tp(10) * eps)
699 {
700 const Tp frac = diff / f0;
701 if (std::abs(frac) > max_abs_frac)
702 max_abs_frac = std::abs(frac);
703 }
704 }
705 VERIFY(max_abs_frac < Tp(2.5000000000000020e-13));
706 }
707
708 // Test data for l=5, m=5.
709 testcase_assoc_legendre<double> data010[] = {
710 { -0.0000000000000000, 5, 5,
711 -1.0000000000000000 },
712 { -14.870165800941818, 5, 5,
713 -0.90000000000000002 },
714 { -73.483199999999925, 5, 5,
715 -0.80000000000000004 },
716 { -175.53238298794764, 5, 5,
717 -0.69999999999999996 },
718 { -309.65760000000006, 5, 5,
719 -0.59999999999999998 },
720 { -460.34662869916559, 5, 5,
721 -0.50000000000000000 },
722 { -611.12496255819883, 5, 5,
723 -0.40000000000000002 },
724 { -746.50941479523760, 5, 5,
725 -0.30000000000000004 },
726 { -853.31600434671316, 5, 5,
727 -0.19999999999999996 },
728 { -921.55189181724734, 5, 5,
729 -0.099999999999999978 },
730 { -945.00000000000000, 5, 5,
731 0.0000000000000000 },
732 { -921.55189181724734, 5, 5,
733 0.10000000000000009 },
734 { -853.31600434671316, 5, 5,
735 0.19999999999999996 },
736 { -746.50941479523760, 5, 5,
737 0.30000000000000004 },
738 { -611.12496255819883, 5, 5,
739 0.39999999999999991 },
740 { -460.34662869916559, 5, 5,
741 0.50000000000000000 },
742 { -309.65759999999989, 5, 5,
743 0.60000000000000009 },
744 { -175.53238298794764, 5, 5,
745 0.69999999999999996 },
746 { -73.483199999999925, 5, 5,
747 0.80000000000000004 },
748 { -14.870165800941855, 5, 5,
749 0.89999999999999991 },
750 { -0.0000000000000000, 5, 5,
751 1.0000000000000000 },
752 };
753
754 // Test function for l=5, m=5.
755 template <typename Tp>
756 void test010()
757 {
758 const Tp eps = std::numeric_limits<Tp>::epsilon();
759 Tp max_abs_diff = -Tp(1);
760 Tp max_abs_frac = -Tp(1);
761 unsigned int num_datum = sizeof(data010)
762 / sizeof(testcase_assoc_legendre<double>);
763 for (unsigned int i = 0; i < num_datum; ++i)
764 {
765 const Tp f = std::tr1::assoc_legendre(Tp(data010[i].l), Tp(data010[i].m),
766 Tp(data010[i].x));
767 const Tp f0 = data010[i].f0;
768 const Tp diff = f - f0;
769 if (std::abs(diff) > max_abs_diff)
770 max_abs_diff = std::abs(diff);
771 if (std::abs(f0) > Tp(10) * eps
772 && std::abs(f) > Tp(10) * eps)
773 {
774 const Tp frac = diff / f0;
775 if (std::abs(frac) > max_abs_frac)
776 max_abs_frac = std::abs(frac);
777 }
778 }
779 VERIFY(max_abs_frac < Tp(2.5000000000000020e-13));
780 }
781
782 // Test data for l=10, m=0.
783 testcase_assoc_legendre<double> data011[] = {
784 { 1.0000000000000000, 10, 0,
785 -1.0000000000000000 },
786 { -0.26314561785585977, 10, 0,
787 -0.90000000000000002 },
788 { 0.30052979559999998, 10, 0,
789 -0.80000000000000004 },
790 { 0.085805795531640333, 10, 0,
791 -0.69999999999999996 },
792 { -0.24366274560000006, 10, 0,
793 -0.59999999999999998 },
794 { -0.18822860717773438, 10, 0,
795 -0.50000000000000000 },
796 { 0.096839064399999869, 10, 0,
797 -0.40000000000000002 },
798 { 0.25147634951601561, 10, 0,
799 -0.30000000000000004 },
800 { 0.12907202559999989, 10, 0,
801 -0.19999999999999996 },
802 { -0.12212499738710947, 10, 0,
803 -0.099999999999999978 },
804 { -0.24609375000000000, 10, 0,
805 0.0000000000000000 },
806 { -0.12212499738710922, 10, 0,
807 0.10000000000000009 },
808 { 0.12907202559999989, 10, 0,
809 0.19999999999999996 },
810 { 0.25147634951601561, 10, 0,
811 0.30000000000000004 },
812 { 0.096839064400000258, 10, 0,
813 0.39999999999999991 },
814 { -0.18822860717773438, 10, 0,
815 0.50000000000000000 },
816 { -0.24366274559999987, 10, 0,
817 0.60000000000000009 },
818 { 0.085805795531640333, 10, 0,
819 0.69999999999999996 },
820 { 0.30052979559999998, 10, 0,
821 0.80000000000000004 },
822 { -0.26314561785585888, 10, 0,
823 0.89999999999999991 },
824 { 1.0000000000000000, 10, 0,
825 1.0000000000000000 },
826 };
827
828 // Test function for l=10, m=0.
829 template <typename Tp>
830 void test011()
831 {
832 const Tp eps = std::numeric_limits<Tp>::epsilon();
833 Tp max_abs_diff = -Tp(1);
834 Tp max_abs_frac = -Tp(1);
835 unsigned int num_datum = sizeof(data011)
836 / sizeof(testcase_assoc_legendre<double>);
837 for (unsigned int i = 0; i < num_datum; ++i)
838 {
839 const Tp f = std::tr1::assoc_legendre(Tp(data011[i].l), Tp(data011[i].m),
840 Tp(data011[i].x));
841 const Tp f0 = data011[i].f0;
842 const Tp diff = f - f0;
843 if (std::abs(diff) > max_abs_diff)
844 max_abs_diff = std::abs(diff);
845 if (std::abs(f0) > Tp(10) * eps
846 && std::abs(f) > Tp(10) * eps)
847 {
848 const Tp frac = diff / f0;
849 if (std::abs(frac) > max_abs_frac)
850 max_abs_frac = std::abs(frac);
851 }
852 }
853 VERIFY(max_abs_frac < Tp(2.5000000000000020e-13));
854 }
855
856 // Test data for l=10, m=1.
857 testcase_assoc_legendre<double> data012[] = {
858 { -0.0000000000000000, 10, 1,
859 -1.0000000000000000 },
860 { -3.0438748781479061, 10, 1,
861 -0.90000000000000002 },
862 { -0.87614260800000199, 10, 1,
863 -0.80000000000000004 },
864 { 2.9685359952934522, 10, 1,
865 -0.69999999999999996 },
866 { 1.2511825919999990, 10, 1,
867 -0.59999999999999998 },
868 { -2.0066877394361260, 10, 1,
869 -0.50000000000000000 },
870 { -2.4822196173476661, 10, 1,
871 -0.40000000000000002 },
872 { -0.12309508907433941, 10, 1,
873 -0.30000000000000004 },
874 { 2.2468221751958408, 10, 1,
875 -0.19999999999999996 },
876 { 2.2472659777983512, 10, 1,
877 -0.099999999999999978 },
878 { -0.0000000000000000, 10, 1,
879 0.0000000000000000 },
880 { -2.2472659777983530, 10, 1,
881 0.10000000000000009 },
882 { -2.2468221751958408, 10, 1,
883 0.19999999999999996 },
884 { 0.12309508907433941, 10, 1,
885 0.30000000000000004 },
886 { 2.4822196173476643, 10, 1,
887 0.39999999999999991 },
888 { 2.0066877394361260, 10, 1,
889 0.50000000000000000 },
890 { -1.2511825920000037, 10, 1,
891 0.60000000000000009 },
892 { -2.9685359952934522, 10, 1,
893 0.69999999999999996 },
894 { 0.87614260800000199, 10, 1,
895 0.80000000000000004 },
896 { 3.0438748781479110, 10, 1,
897 0.89999999999999991 },
898 { 0.0000000000000000, 10, 1,
899 1.0000000000000000 },
900 };
901
902 // Test function for l=10, m=1.
903 template <typename Tp>
904 void test012()
905 {
906 const Tp eps = std::numeric_limits<Tp>::epsilon();
907 Tp max_abs_diff = -Tp(1);
908 Tp max_abs_frac = -Tp(1);
909 unsigned int num_datum = sizeof(data012)
910 / sizeof(testcase_assoc_legendre<double>);
911 for (unsigned int i = 0; i < num_datum; ++i)
912 {
913 const Tp f = std::tr1::assoc_legendre(Tp(data012[i].l), Tp(data012[i].m),
914 Tp(data012[i].x));
915 const Tp f0 = data012[i].f0;
916 const Tp diff = f - f0;
917 if (std::abs(diff) > max_abs_diff)
918 max_abs_diff = std::abs(diff);
919 if (std::abs(f0) > Tp(10) * eps
920 && std::abs(f) > Tp(10) * eps)
921 {
922 const Tp frac = diff / f0;
923 if (std::abs(frac) > max_abs_frac)
924 max_abs_frac = std::abs(frac);
925 }
926 }
927 VERIFY(max_abs_frac < Tp(2.5000000000000020e-13));
928 }
929
930 // Test data for l=10, m=2.
931 testcase_assoc_legendre<double> data013[] = {
932 { 0.0000000000000000, 10, 2,
933 -1.0000000000000000 },
934 { 16.376387762496122, 10, 2,
935 -0.90000000000000002 },
936 { -35.394657803999991, 10, 2,
937 -0.80000000000000004 },
938 { -3.6191429423788892, 10, 2,
939 -0.69999999999999996 },
940 { 28.679675904000010, 10, 2,
941 -0.59999999999999998 },
942 { 18.388023376464844, 10, 2,
943 -0.50000000000000000 },
944 { -12.818955995999996, 10, 2,
945 -0.40000000000000002 },
946 { -27.739821675972660, 10, 2,
947 -0.30000000000000004 },
948 { -13.280661503999987, 10, 2,
949 -0.19999999999999996 },
950 { 13.885467170308596, 10, 2,
951 -0.099999999999999978 },
952 { 27.070312500000000, 10, 2,
953 0.0000000000000000 },
954 { 13.885467170308573, 10, 2,
955 0.10000000000000009 },
956 { -13.280661503999987, 10, 2,
957 0.19999999999999996 },
958 { -27.739821675972660, 10, 2,
959 0.30000000000000004 },
960 { -12.818955996000019, 10, 2,
961 0.39999999999999991 },
962 { 18.388023376464844, 10, 2,
963 0.50000000000000000 },
964 { 28.679675903999982, 10, 2,
965 0.60000000000000009 },
966 { -3.6191429423788892, 10, 2,
967 0.69999999999999996 },
968 { -35.394657803999991, 10, 2,
969 0.80000000000000004 },
970 { 16.376387762495984, 10, 2,
971 0.89999999999999991 },
972 { 0.0000000000000000, 10, 2,
973 1.0000000000000000 },
974 };
975
976 // Test function for l=10, m=2.
977 template <typename Tp>
978 void test013()
979 {
980 const Tp eps = std::numeric_limits<Tp>::epsilon();
981 Tp max_abs_diff = -Tp(1);
982 Tp max_abs_frac = -Tp(1);
983 unsigned int num_datum = sizeof(data013)
984 / sizeof(testcase_assoc_legendre<double>);
985 for (unsigned int i = 0; i < num_datum; ++i)
986 {
987 const Tp f = std::tr1::assoc_legendre(Tp(data013[i].l), Tp(data013[i].m),
988 Tp(data013[i].x));
989 const Tp f0 = data013[i].f0;
990 const Tp diff = f - f0;
991 if (std::abs(diff) > max_abs_diff)
992 max_abs_diff = std::abs(diff);
993 if (std::abs(f0) > Tp(10) * eps
994 && std::abs(f) > Tp(10) * eps)
995 {
996 const Tp frac = diff / f0;
997 if (std::abs(frac) > max_abs_frac)
998 max_abs_frac = std::abs(frac);
999 }
1000 }
1001 VERIFY(max_abs_frac < Tp(5.0000000000000039e-13));
1002 }
1003
1004 // Test data for l=10, m=5.
1005 testcase_assoc_legendre<double> data014[] = {
1006 { 0.0000000000000000, 10, 5,
1007 -1.0000000000000000 },
1008 { 21343.618518164669, 10, 5,
1009 -0.90000000000000002 },
1010 { 40457.016407807983, 10, 5,
1011 -0.80000000000000004 },
1012 { 20321.279317331318, 10, 5,
1013 -0.69999999999999996 },
1014 { -14410.820616192013, 10, 5,
1015 -0.59999999999999998 },
1016 { -30086.169706116176, 10, 5,
1017 -0.50000000000000000 },
1018 { -17177.549337582859, 10, 5,
1019 -0.40000000000000002 },
1020 { 9272.5119495412346, 10, 5,
1021 -0.30000000000000004 },
1022 { 26591.511184414714, 10, 5,
1023 -0.19999999999999996 },
1024 { 21961.951238504211, 10, 5,
1025 -0.099999999999999978 },
1026 { -0.0000000000000000, 10, 5,
1027 0.0000000000000000 },
1028 { -21961.951238504229, 10, 5,
1029 0.10000000000000009 },
1030 { -26591.511184414714, 10, 5,
1031 0.19999999999999996 },
1032 { -9272.5119495412346, 10, 5,
1033 0.30000000000000004 },
1034 { 17177.549337582830, 10, 5,
1035 0.39999999999999991 },
1036 { 30086.169706116176, 10, 5,
1037 0.50000000000000000 },
1038 { 14410.820616191975, 10, 5,
1039 0.60000000000000009 },
1040 { -20321.279317331318, 10, 5,
1041 0.69999999999999996 },
1042 { -40457.016407807983, 10, 5,
1043 0.80000000000000004 },
1044 { -21343.618518164698, 10, 5,
1045 0.89999999999999991 },
1046 { 0.0000000000000000, 10, 5,
1047 1.0000000000000000 },
1048 };
1049
1050 // Test function for l=10, m=5.
1051 template <typename Tp>
1052 void test014()
1053 {
1054 const Tp eps = std::numeric_limits<Tp>::epsilon();
1055 Tp max_abs_diff = -Tp(1);
1056 Tp max_abs_frac = -Tp(1);
1057 unsigned int num_datum = sizeof(data014)
1058 / sizeof(testcase_assoc_legendre<double>);
1059 for (unsigned int i = 0; i < num_datum; ++i)
1060 {
1061 const Tp f = std::tr1::assoc_legendre(Tp(data014[i].l), Tp(data014[i].m),
1062 Tp(data014[i].x));
1063 const Tp f0 = data014[i].f0;
1064 const Tp diff = f - f0;
1065 if (std::abs(diff) > max_abs_diff)
1066 max_abs_diff = std::abs(diff);
1067 if (std::abs(f0) > Tp(10) * eps
1068 && std::abs(f) > Tp(10) * eps)
1069 {
1070 const Tp frac = diff / f0;
1071 if (std::abs(frac) > max_abs_frac)
1072 max_abs_frac = std::abs(frac);
1073 }
1074 }
1075 VERIFY(max_abs_frac < Tp(2.5000000000000020e-13));
1076 }
1077
1078 // Test data for l=10, m=10.
1079 testcase_assoc_legendre<double> data015[] = {
1080 { 0.0000000000000000, 10, 10,
1081 -1.0000000000000000 },
1082 { 162117.40078784220, 10, 10,
1083 -0.90000000000000002 },
1084 { 3958896.3481267113, 10, 10,
1085 -0.80000000000000004 },
1086 { 22589806.343887307, 10, 10,
1087 -0.69999999999999996 },
1088 { 70300999.121633321, 10, 10,
1089 -0.59999999999999998 },
1090 { 155370278.54003900, 10, 10,
1091 -0.50000000000000000 },
1092 { 273815518.20150518, 10, 10,
1093 -0.40000000000000002 },
1094 { 408571989.13158917, 10, 10,
1095 -0.30000000000000004 },
1096 { 533848212.07990247, 10, 10,
1097 -0.19999999999999996 },
1098 { 622640835.70523083, 10, 10,
1099 -0.099999999999999978 },
1100 { 654729075.00000000, 10, 10,
1101 0.0000000000000000 },
1102 { 622640835.70523083, 10, 10,
1103 0.10000000000000009 },
1104 { 533848212.07990247, 10, 10,
1105 0.19999999999999996 },
1106 { 408571989.13158917, 10, 10,
1107 0.30000000000000004 },
1108 { 273815518.20150518, 10, 10,
1109 0.39999999999999991 },
1110 { 155370278.54003900, 10, 10,
1111 0.50000000000000000 },
1112 { 70300999.121633217, 10, 10,
1113 0.60000000000000009 },
1114 { 22589806.343887307, 10, 10,
1115 0.69999999999999996 },
1116 { 3958896.3481267113, 10, 10,
1117 0.80000000000000004 },
1118 { 162117.40078784304, 10, 10,
1119 0.89999999999999991 },
1120 { 0.0000000000000000, 10, 10,
1121 1.0000000000000000 },
1122 };
1123
1124 // Test function for l=10, m=10.
1125 template <typename Tp>
1126 void test015()
1127 {
1128 const Tp eps = std::numeric_limits<Tp>::epsilon();
1129 Tp max_abs_diff = -Tp(1);
1130 Tp max_abs_frac = -Tp(1);
1131 unsigned int num_datum = sizeof(data015)
1132 / sizeof(testcase_assoc_legendre<double>);
1133 for (unsigned int i = 0; i < num_datum; ++i)
1134 {
1135 const Tp f = std::tr1::assoc_legendre(Tp(data015[i].l), Tp(data015[i].m),
1136 Tp(data015[i].x));
1137 const Tp f0 = data015[i].f0;
1138 const Tp diff = f - f0;
1139 if (std::abs(diff) > max_abs_diff)
1140 max_abs_diff = std::abs(diff);
1141 if (std::abs(f0) > Tp(10) * eps
1142 && std::abs(f) > Tp(10) * eps)
1143 {
1144 const Tp frac = diff / f0;
1145 if (std::abs(frac) > max_abs_frac)
1146 max_abs_frac = std::abs(frac);
1147 }
1148 }
1149 VERIFY(max_abs_frac < Tp(2.5000000000000020e-13));
1150 }
1151
1152 // Test data for l=20, m=0.
1153 testcase_assoc_legendre<double> data016[] = {
1154 { 1.0000000000000000, 20, 0,
1155 -1.0000000000000000 },
1156 { -0.14930823530984821, 20, 0,
1157 -0.90000000000000002 },
1158 { 0.22420460541741344, 20, 0,
1159 -0.80000000000000004 },
1160 { -0.20457394463834172, 20, 0,
1161 -0.69999999999999996 },
1162 { 0.15916752910098114, 20, 0,
1163 -0.59999999999999998 },
1164 { -0.048358381067373557, 20, 0,
1165 -0.50000000000000000 },
1166 { -0.10159261558628156, 20, 0,
1167 -0.40000000000000002 },
1168 { 0.18028715947998047, 20, 0,
1169 -0.30000000000000004 },
1170 { -0.098042194344594741, 20, 0,
1171 -0.19999999999999996 },
1172 { -0.082077130944527649, 20, 0,
1173 -0.099999999999999978 },
1174 { 0.17619705200195312, 20, 0,
1175 0.0000000000000000 },
1176 { -0.082077130944528037, 20, 0,
1177 0.10000000000000009 },
1178 { -0.098042194344594741, 20, 0,
1179 0.19999999999999996 },
1180 { 0.18028715947998047, 20, 0,
1181 0.30000000000000004 },
1182 { -0.10159261558628112, 20, 0,
1183 0.39999999999999991 },
1184 { -0.048358381067373557, 20, 0,
1185 0.50000000000000000 },
1186 { 0.15916752910098084, 20, 0,
1187 0.60000000000000009 },
1188 { -0.20457394463834172, 20, 0,
1189 0.69999999999999996 },
1190 { 0.22420460541741344, 20, 0,
1191 0.80000000000000004 },
1192 { -0.14930823530984949, 20, 0,
1193 0.89999999999999991 },
1194 { 1.0000000000000000, 20, 0,
1195 1.0000000000000000 },
1196 };
1197
1198 // Test function for l=20, m=0.
1199 template <typename Tp>
1200 void test016()
1201 {
1202 const Tp eps = std::numeric_limits<Tp>::epsilon();
1203 Tp max_abs_diff = -Tp(1);
1204 Tp max_abs_frac = -Tp(1);
1205 unsigned int num_datum = sizeof(data016)
1206 / sizeof(testcase_assoc_legendre<double>);
1207 for (unsigned int i = 0; i < num_datum; ++i)
1208 {
1209 const Tp f = std::tr1::assoc_legendre(Tp(data016[i].l), Tp(data016[i].m),
1210 Tp(data016[i].x));
1211 const Tp f0 = data016[i].f0;
1212 const Tp diff = f - f0;
1213 if (std::abs(diff) > max_abs_diff)
1214 max_abs_diff = std::abs(diff);
1215 if (std::abs(f0) > Tp(10) * eps
1216 && std::abs(f) > Tp(10) * eps)
1217 {
1218 const Tp frac = diff / f0;
1219 if (std::abs(frac) > max_abs_frac)
1220 max_abs_frac = std::abs(frac);
1221 }
1222 }
1223 VERIFY(max_abs_frac < Tp(2.5000000000000020e-13));
1224 }
1225
1226 // Test data for l=20, m=1.
1227 testcase_assoc_legendre<double> data017[] = {
1228 { 0.0000000000000000, 20, 1,
1229 -1.0000000000000000 },
1230 { 4.3838334818220490, 20, 1,
1231 -0.90000000000000002 },
1232 { -0.63138296146340556, 20, 1,
1233 -0.80000000000000004 },
1234 { 0.72274871413391228, 20, 1,
1235 -0.69999999999999996 },
1236 { -2.3203528743824893, 20, 1,
1237 -0.59999999999999998 },
1238 { 3.7399919228791405, 20, 1,
1239 -0.50000000000000000 },
1240 { -3.1692202279270028, 20, 1,
1241 -0.40000000000000002 },
1242 { 0.15804468835344049, 20, 1,
1243 -0.30000000000000004 },
1244 { 3.0366182393271162, 20, 1,
1245 -0.19999999999999996 },
1246 { -3.2115523815580209, 20, 1,
1247 -0.099999999999999978 },
1248 { 0.0000000000000000, 20, 1,
1249 0.0000000000000000 },
1250 { 3.2115523815580160, 20, 1,
1251 0.10000000000000009 },
1252 { -3.0366182393271162, 20, 1,
1253 0.19999999999999996 },
1254 { -0.15804468835344049, 20, 1,
1255 0.30000000000000004 },
1256 { 3.1692202279270076, 20, 1,
1257 0.39999999999999991 },
1258 { -3.7399919228791405, 20, 1,
1259 0.50000000000000000 },
1260 { 2.3203528743825008, 20, 1,
1261 0.60000000000000009 },
1262 { -0.72274871413391228, 20, 1,
1263 0.69999999999999996 },
1264 { 0.63138296146340556, 20, 1,
1265 0.80000000000000004 },
1266 { -4.3838334818220304, 20, 1,
1267 0.89999999999999991 },
1268 { 0.0000000000000000, 20, 1,
1269 1.0000000000000000 },
1270 };
1271
1272 // Test function for l=20, m=1.
1273 template <typename Tp>
1274 void test017()
1275 {
1276 const Tp eps = std::numeric_limits<Tp>::epsilon();
1277 Tp max_abs_diff = -Tp(1);
1278 Tp max_abs_frac = -Tp(1);
1279 unsigned int num_datum = sizeof(data017)
1280 / sizeof(testcase_assoc_legendre<double>);
1281 for (unsigned int i = 0; i < num_datum; ++i)
1282 {
1283 const Tp f = std::tr1::assoc_legendre(Tp(data017[i].l), Tp(data017[i].m),
1284 Tp(data017[i].x));
1285 const Tp f0 = data017[i].f0;
1286 const Tp diff = f - f0;
1287 if (std::abs(diff) > max_abs_diff)
1288 max_abs_diff = std::abs(diff);
1289 if (std::abs(f0) > Tp(10) * eps
1290 && std::abs(f) > Tp(10) * eps)
1291 {
1292 const Tp frac = diff / f0;
1293 if (std::abs(frac) > max_abs_frac)
1294 max_abs_frac = std::abs(frac);
1295 }
1296 }
1297 VERIFY(max_abs_frac < Tp(5.0000000000000039e-13));
1298 }
1299
1300 // Test data for l=20, m=2.
1301 testcase_assoc_legendre<double> data018[] = {
1302 { 0.0000000000000000, 20, 2,
1303 -1.0000000000000000 },
1304 { 80.812425587310116, 20, 2,
1305 -0.90000000000000002 },
1306 { -95.849622172549317, 20, 2,
1307 -0.80000000000000004 },
1308 { 87.337927630325510, 20, 2,
1309 -0.69999999999999996 },
1310 { -70.330891533985834, 20, 2,
1311 -0.59999999999999998 },
1312 { 24.629090735179489, 20, 2,
1313 -0.50000000000000000 },
1314 { 39.902576338912418, 20, 2,
1315 -0.40000000000000002 },
1316 { -75.621201471396589, 20, 2,
1317 -0.30000000000000004 },
1318 { 42.417415829726487, 20, 2,
1319 -0.19999999999999996 },
1320 { 33.826848678871301, 20, 2,
1321 -0.099999999999999978 },
1322 { -74.002761840820312, 20, 2,
1323 0.0000000000000000 },
1324 { 33.826848678871457, 20, 2,
1325 0.10000000000000009 },
1326 { 42.417415829726487, 20, 2,
1327 0.19999999999999996 },
1328 { -75.621201471396589, 20, 2,
1329 0.30000000000000004 },
1330 { 39.902576338912240, 20, 2,
1331 0.39999999999999991 },
1332 { 24.629090735179489, 20, 2,
1333 0.50000000000000000 },
1334 { -70.330891533985664, 20, 2,
1335 0.60000000000000009 },
1336 { 87.337927630325510, 20, 2,
1337 0.69999999999999996 },
1338 { -95.849622172549317, 20, 2,
1339 0.80000000000000004 },
1340 { 80.812425587310585, 20, 2,
1341 0.89999999999999991 },
1342 { 0.0000000000000000, 20, 2,
1343 1.0000000000000000 },
1344 };
1345
1346 // Test function for l=20, m=2.
1347 template <typename Tp>
1348 void test018()
1349 {
1350 const Tp eps = std::numeric_limits<Tp>::epsilon();
1351 Tp max_abs_diff = -Tp(1);
1352 Tp max_abs_frac = -Tp(1);
1353 unsigned int num_datum = sizeof(data018)
1354 / sizeof(testcase_assoc_legendre<double>);
1355 for (unsigned int i = 0; i < num_datum; ++i)
1356 {
1357 const Tp f = std::tr1::assoc_legendre(Tp(data018[i].l), Tp(data018[i].m),
1358 Tp(data018[i].x));
1359 const Tp f0 = data018[i].f0;
1360 const Tp diff = f - f0;
1361 if (std::abs(diff) > max_abs_diff)
1362 max_abs_diff = std::abs(diff);
1363 if (std::abs(f0) > Tp(10) * eps
1364 && std::abs(f) > Tp(10) * eps)
1365 {
1366 const Tp frac = diff / f0;
1367 if (std::abs(frac) > max_abs_frac)
1368 max_abs_frac = std::abs(frac);
1369 }
1370 }
1371 VERIFY(max_abs_frac < Tp(2.5000000000000020e-13));
1372 }
1373
1374 // Test data for l=20, m=5.
1375 testcase_assoc_legendre<double> data019[] = {
1376 { -0.0000000000000000, 20, 5,
1377 -1.0000000000000000 },
1378 { -315702.32715134107, 20, 5,
1379 -0.90000000000000002 },
1380 { 503060.91484852595, 20, 5,
1381 -0.80000000000000004 },
1382 { -298127.28360361949, 20, 5,
1383 -0.69999999999999996 },
1384 { -114444.61447464002, 20, 5,
1385 -0.59999999999999998 },
1386 { 543428.40914592857, 20, 5,
1387 -0.50000000000000000 },
1388 { -613842.07728185481, 20, 5,
1389 -0.40000000000000002 },
1390 { 143765.42411270953, 20, 5,
1391 -0.30000000000000004 },
1392 { 472600.45321372297, 20, 5,
1393 -0.19999999999999996 },
1394 { -563861.76771496492, 20, 5,
1395 -0.099999999999999978 },
1396 { 0.0000000000000000, 20, 5,
1397 0.0000000000000000 },
1398 { 563861.76771496458, 20, 5,
1399 0.10000000000000009 },
1400 { -472600.45321372297, 20, 5,
1401 0.19999999999999996 },
1402 { -143765.42411270953, 20, 5,
1403 0.30000000000000004 },
1404 { 613842.07728185505, 20, 5,
1405 0.39999999999999991 },
1406 { -543428.40914592857, 20, 5,
1407 0.50000000000000000 },
1408 { 114444.61447464184, 20, 5,
1409 0.60000000000000009 },
1410 { 298127.28360361949, 20, 5,
1411 0.69999999999999996 },
1412 { -503060.91484852595, 20, 5,
1413 0.80000000000000004 },
1414 { 315702.32715134590, 20, 5,
1415 0.89999999999999991 },
1416 { 0.0000000000000000, 20, 5,
1417 1.0000000000000000 },
1418 };
1419
1420 // Test function for l=20, m=5.
1421 template <typename Tp>
1422 void test019()
1423 {
1424 const Tp eps = std::numeric_limits<Tp>::epsilon();
1425 Tp max_abs_diff = -Tp(1);
1426 Tp max_abs_frac = -Tp(1);
1427 unsigned int num_datum = sizeof(data019)
1428 / sizeof(testcase_assoc_legendre<double>);
1429 for (unsigned int i = 0; i < num_datum; ++i)
1430 {
1431 const Tp f = std::tr1::assoc_legendre(Tp(data019[i].l), Tp(data019[i].m),
1432 Tp(data019[i].x));
1433 const Tp f0 = data019[i].f0;
1434 const Tp diff = f - f0;
1435 if (std::abs(diff) > max_abs_diff)
1436 max_abs_diff = std::abs(diff);
1437 if (std::abs(f0) > Tp(10) * eps
1438 && std::abs(f) > Tp(10) * eps)
1439 {
1440 const Tp frac = diff / f0;
1441 if (std::abs(frac) > max_abs_frac)
1442 max_abs_frac = std::abs(frac);
1443 }
1444 }
1445 VERIFY(max_abs_frac < Tp(2.5000000000000020e-13));
1446 }
1447
1448 // Test data for l=20, m=10.
1449 testcase_assoc_legendre<double> data020[] = {
1450 { -0.0000000000000000, 20, 10,
1451 -1.0000000000000000 },
1452 { 990017476694.99084, 20, 10,
1453 -0.90000000000000002 },
1454 { 2392757933281.0503, 20, 10,
1455 -0.80000000000000004 },
1456 { -1548364524949.5808, 20, 10,
1457 -0.69999999999999996 },
1458 { -424471915195.05609, 20, 10,
1459 -0.59999999999999998 },
1460 { 1744502295946.2065, 20, 10,
1461 -0.50000000000000000 },
1462 { -899973487310.55212, 20, 10,
1463 -0.40000000000000002 },
1464 { -1092420454297.7164, 20, 10,
1465 -0.30000000000000004 },
1466 { 1466609267659.8816, 20, 10,
1467 -0.19999999999999996 },
1468 { 356041756390.71661, 20, 10,
1469 -0.099999999999999978 },
1470 { -1612052956674.3164, 20, 10,
1471 0.0000000000000000 },
1472 { 356041756390.71985, 20, 10,
1473 0.10000000000000009 },
1474 { 1466609267659.8816, 20, 10,
1475 0.19999999999999996 },
1476 { -1092420454297.7164, 20, 10,
1477 0.30000000000000004 },
1478 { -899973487310.55469, 20, 10,
1479 0.39999999999999991 },
1480 { 1744502295946.2065, 20, 10,
1481 0.50000000000000000 },
1482 { -424471915195.05914, 20, 10,
1483 0.60000000000000009 },
1484 { -1548364524949.5808, 20, 10,
1485 0.69999999999999996 },
1486 { 2392757933281.0503, 20, 10,
1487 0.80000000000000004 },
1488 { 990017476694.99353, 20, 10,
1489 0.89999999999999991 },
1490 { 0.0000000000000000, 20, 10,
1491 1.0000000000000000 },
1492 };
1493
1494 // Test function for l=20, m=10.
1495 template <typename Tp>
1496 void test020()
1497 {
1498 const Tp eps = std::numeric_limits<Tp>::epsilon();
1499 Tp max_abs_diff = -Tp(1);
1500 Tp max_abs_frac = -Tp(1);
1501 unsigned int num_datum = sizeof(data020)
1502 / sizeof(testcase_assoc_legendre<double>);
1503 for (unsigned int i = 0; i < num_datum; ++i)
1504 {
1505 const Tp f = std::tr1::assoc_legendre(Tp(data020[i].l), Tp(data020[i].m),
1506 Tp(data020[i].x));
1507 const Tp f0 = data020[i].f0;
1508 const Tp diff = f - f0;
1509 if (std::abs(diff) > max_abs_diff)
1510 max_abs_diff = std::abs(diff);
1511 if (std::abs(f0) > Tp(10) * eps
1512 && std::abs(f) > Tp(10) * eps)
1513 {
1514 const Tp frac = diff / f0;
1515 if (std::abs(frac) > max_abs_frac)
1516 max_abs_frac = std::abs(frac);
1517 }
1518 }
1519 VERIFY(max_abs_frac < Tp(2.5000000000000020e-13));
1520 }
1521
1522 // Test data for l=20, m=20.
1523 testcase_assoc_legendre<double> data021[] = {
1524 { 0.0000000000000000, 20, 20,
1525 -1.0000000000000000 },
1526 { 19609049712023808., 20, 20,
1527 -0.90000000000000002 },
1528 { 1.1693527616833221e+19, 20, 20,
1529 -0.80000000000000004 },
1530 { 3.8073455880620691e+20, 20, 20,
1531 -0.69999999999999996 },
1532 { 3.6874002249007927e+21, 20, 20,
1533 -0.59999999999999998 },
1534 { 1.8010806978179592e+22, 20, 20,
1535 -0.50000000000000000 },
1536 { 5.5938832584012466e+22, 20, 20,
1537 -0.40000000000000002 },
1538 { 1.2454734132297811e+23, 20, 20,
1539 -0.30000000000000004 },
1540 { 2.1263407800797497e+23, 20, 20,
1541 -0.19999999999999996 },
1542 { 2.8924941146976873e+23, 20, 20,
1543 -0.099999999999999978 },
1544 { 3.1983098677287775e+23, 20, 20,
1545 0.0000000000000000 },
1546 { 2.8924941146976873e+23, 20, 20,
1547 0.10000000000000009 },
1548 { 2.1263407800797497e+23, 20, 20,
1549 0.19999999999999996 },
1550 { 1.2454734132297811e+23, 20, 20,
1551 0.30000000000000004 },
1552 { 5.5938832584012466e+22, 20, 20,
1553 0.39999999999999991 },
1554 { 1.8010806978179592e+22, 20, 20,
1555 0.50000000000000000 },
1556 { 3.6874002249007807e+21, 20, 20,
1557 0.60000000000000009 },
1558 { 3.8073455880620691e+20, 20, 20,
1559 0.69999999999999996 },
1560 { 1.1693527616833221e+19, 20, 20,
1561 0.80000000000000004 },
1562 { 19609049712024020., 20, 20,
1563 0.89999999999999991 },
1564 { 0.0000000000000000, 20, 20,
1565 1.0000000000000000 },
1566 };
1567
1568 // Test function for l=20, m=20.
1569 template <typename Tp>
1570 void test021()
1571 {
1572 const Tp eps = std::numeric_limits<Tp>::epsilon();
1573 Tp max_abs_diff = -Tp(1);
1574 Tp max_abs_frac = -Tp(1);
1575 unsigned int num_datum = sizeof(data021)
1576 / sizeof(testcase_assoc_legendre<double>);
1577 for (unsigned int i = 0; i < num_datum; ++i)
1578 {
1579 const Tp f = std::tr1::assoc_legendre(Tp(data021[i].l), Tp(data021[i].m),
1580 Tp(data021[i].x));
1581 const Tp f0 = data021[i].f0;
1582 const Tp diff = f - f0;
1583 if (std::abs(diff) > max_abs_diff)
1584 max_abs_diff = std::abs(diff);
1585 if (std::abs(f0) > Tp(10) * eps
1586 && std::abs(f) > Tp(10) * eps)
1587 {
1588 const Tp frac = diff / f0;
1589 if (std::abs(frac) > max_abs_frac)
1590 max_abs_frac = std::abs(frac);
1591 }
1592 }
1593 VERIFY(max_abs_frac < Tp(2.5000000000000020e-13));
1594 }
1595
1596 // Test data for l=50, m=0.
1597 testcase_assoc_legendre<double> data022[] = {
1598 { 1.0000000000000000, 50, 0,
1599 -1.0000000000000000 },
1600 { -0.17003765994383685, 50, 0,
1601 -0.90000000000000002 },
1602 { 0.13879737345093118, 50, 0,
1603 -0.80000000000000004 },
1604 { -0.014572731645892805, 50, 0,
1605 -0.69999999999999996 },
1606 { -0.058860798844002173, 50, 0,
1607 -0.59999999999999998 },
1608 { -0.031059099239609828, 50, 0,
1609 -0.50000000000000000 },
1610 { 0.041569033381825368, 50, 0,
1611 -0.40000000000000002 },
1612 { 0.10911051574714808, 50, 0,
1613 -0.30000000000000004 },
1614 { 0.083432272204197466, 50, 0,
1615 -0.19999999999999996 },
1616 { -0.038205812661313579, 50, 0,
1617 -0.099999999999999978 },
1618 { -0.11227517265921705, 50, 0,
1619 0.0000000000000000 },
1620 { -0.038205812661314169, 50, 0,
1621 0.10000000000000009 },
1622 { 0.083432272204197466, 50, 0,
1623 0.19999999999999996 },
1624 { 0.10911051574714808, 50, 0,
1625 0.30000000000000004 },
1626 { 0.041569033381824647, 50, 0,
1627 0.39999999999999991 },
1628 { -0.031059099239609828, 50, 0,
1629 0.50000000000000000 },
1630 { -0.058860798844001430, 50, 0,
1631 0.60000000000000009 },
1632 { -0.014572731645892805, 50, 0,
1633 0.69999999999999996 },
1634 { 0.13879737345093118, 50, 0,
1635 0.80000000000000004 },
1636 { -0.17003765994383663, 50, 0,
1637 0.89999999999999991 },
1638 { 1.0000000000000000, 50, 0,
1639 1.0000000000000000 },
1640 };
1641
1642 // Test function for l=50, m=0.
1643 template <typename Tp>
1644 void test022()
1645 {
1646 const Tp eps = std::numeric_limits<Tp>::epsilon();
1647 Tp max_abs_diff = -Tp(1);
1648 Tp max_abs_frac = -Tp(1);
1649 unsigned int num_datum = sizeof(data022)
1650 / sizeof(testcase_assoc_legendre<double>);
1651 for (unsigned int i = 0; i < num_datum; ++i)
1652 {
1653 const Tp f = std::tr1::assoc_legendre(Tp(data022[i].l), Tp(data022[i].m),
1654 Tp(data022[i].x));
1655 const Tp f0 = data022[i].f0;
1656 const Tp diff = f - f0;
1657 if (std::abs(diff) > max_abs_diff)
1658 max_abs_diff = std::abs(diff);
1659 if (std::abs(f0) > Tp(10) * eps
1660 && std::abs(f) > Tp(10) * eps)
1661 {
1662 const Tp frac = diff / f0;
1663 if (std::abs(frac) > max_abs_frac)
1664 max_abs_frac = std::abs(frac);
1665 }
1666 }
1667 VERIFY(max_abs_frac < Tp(2.5000000000000020e-13));
1668 }
1669
1670 // Test data for l=50, m=1.
1671 testcase_assoc_legendre<double> data023[] = {
1672 { 0.0000000000000000, 50, 1,
1673 -1.0000000000000000 },
1674 { -0.13424149984450387, 50, 1,
1675 -0.90000000000000002 },
1676 { 2.2011219672413085, 50, 1,
1677 -0.80000000000000004 },
1678 { 6.6622414993232013, 50, 1,
1679 -0.69999999999999996 },
1680 { 5.5772846936919231, 50, 1,
1681 -0.59999999999999998 },
1682 { 5.8787148815607617, 50, 1,
1683 -0.50000000000000000 },
1684 { 5.5473459458634000, 50, 1,
1685 -0.40000000000000002 },
1686 { 1.8444956647619912, 50, 1,
1687 -0.30000000000000004 },
1688 { -3.8722014306642150, 50, 1,
1689 -0.19999999999999996 },
1690 { -5.3488751322285593, 50, 1,
1691 -0.099999999999999978 },
1692 { -0.0000000000000000, 50, 1,
1693 0.0000000000000000 },
1694 { 5.3488751322285459, 50, 1,
1695 0.10000000000000009 },
1696 { 3.8722014306642150, 50, 1,
1697 0.19999999999999996 },
1698 { -1.8444956647619912, 50, 1,
1699 0.30000000000000004 },
1700 { -5.5473459458634098, 50, 1,
1701 0.39999999999999991 },
1702 { -5.8787148815607617, 50, 1,
1703 0.50000000000000000 },
1704 { -5.5772846936919489, 50, 1,
1705 0.60000000000000009 },
1706 { -6.6622414993232013, 50, 1,
1707 0.69999999999999996 },
1708 { -2.2011219672413085, 50, 1,
1709 0.80000000000000004 },
1710 { 0.13424149984460862, 50, 1,
1711 0.89999999999999991 },
1712 { 0.0000000000000000, 50, 1,
1713 1.0000000000000000 },
1714 };
1715
1716 // Test function for l=50, m=1.
1717 template <typename Tp>
1718 void test023()
1719 {
1720 const Tp eps = std::numeric_limits<Tp>::epsilon();
1721 Tp max_abs_diff = -Tp(1);
1722 Tp max_abs_frac = -Tp(1);
1723 unsigned int num_datum = sizeof(data023)
1724 / sizeof(testcase_assoc_legendre<double>);
1725 for (unsigned int i = 0; i < num_datum; ++i)
1726 {
1727 const Tp f = std::tr1::assoc_legendre(Tp(data023[i].l), Tp(data023[i].m),
1728 Tp(data023[i].x));
1729 const Tp f0 = data023[i].f0;
1730 const Tp diff = f - f0;
1731 if (std::abs(diff) > max_abs_diff)
1732 max_abs_diff = std::abs(diff);
1733 if (std::abs(f0) > Tp(10) * eps
1734 && std::abs(f) > Tp(10) * eps)
1735 {
1736 const Tp frac = diff / f0;
1737 if (std::abs(frac) > max_abs_frac)
1738 max_abs_frac = std::abs(frac);
1739 }
1740 }
1741 VERIFY(max_abs_frac < Tp(5.0000000000000029e-12));
1742 }
1743
1744 // Test data for l=50, m=2.
1745 testcase_assoc_legendre<double> data024[] = {
1746 { 0.0000000000000000, 50, 2,
1747 -1.0000000000000000 },
1748 { 433.04168483713448, 50, 2,
1749 -0.90000000000000002 },
1750 { -348.06364372056390, 50, 2,
1751 -0.80000000000000004 },
1752 { 50.221071418108465, 50, 2,
1753 -0.69999999999999996 },
1754 { 158.46096409274341, 50, 2,
1755 -0.59999999999999998 },
1756 { 85.988858299721414, 50, 2,
1757 -0.50000000000000000 },
1758 { -101.15891460879277, 50, 2,
1759 -0.40000000000000002 },
1760 { -277.07168105316612, 50, 2,
1761 -0.30000000000000004 },
1762 { -214.33311373510401, 50, 2,
1763 -0.19999999999999996 },
1764 { 96.349657930951722, 50, 2,
1765 -0.099999999999999978 },
1766 { 286.30169028100346, 50, 2,
1767 0.0000000000000000 },
1768 { 96.349657930953285, 50, 2,
1769 0.10000000000000009 },
1770 { -214.33311373510401, 50, 2,
1771 0.19999999999999996 },
1772 { -277.07168105316612, 50, 2,
1773 0.30000000000000004 },
1774 { -101.15891460879106, 50, 2,
1775 0.39999999999999991 },
1776 { 85.988858299721414, 50, 2,
1777 0.50000000000000000 },
1778 { 158.46096409274131, 50, 2,
1779 0.60000000000000009 },
1780 { 50.221071418108465, 50, 2,
1781 0.69999999999999996 },
1782 { -348.06364372056390, 50, 2,
1783 0.80000000000000004 },
1784 { 433.04168483713414, 50, 2,
1785 0.89999999999999991 },
1786 { 0.0000000000000000, 50, 2,
1787 1.0000000000000000 },
1788 };
1789
1790 // Test function for l=50, m=2.
1791 template <typename Tp>
1792 void test024()
1793 {
1794 const Tp eps = std::numeric_limits<Tp>::epsilon();
1795 Tp max_abs_diff = -Tp(1);
1796 Tp max_abs_frac = -Tp(1);
1797 unsigned int num_datum = sizeof(data024)
1798 / sizeof(testcase_assoc_legendre<double>);
1799 for (unsigned int i = 0; i < num_datum; ++i)
1800 {
1801 const Tp f = std::tr1::assoc_legendre(Tp(data024[i].l), Tp(data024[i].m),
1802 Tp(data024[i].x));
1803 const Tp f0 = data024[i].f0;
1804 const Tp diff = f - f0;
1805 if (std::abs(diff) > max_abs_diff)
1806 max_abs_diff = std::abs(diff);
1807 if (std::abs(f0) > Tp(10) * eps
1808 && std::abs(f) > Tp(10) * eps)
1809 {
1810 const Tp frac = diff / f0;
1811 if (std::abs(frac) > max_abs_frac)
1812 max_abs_frac = std::abs(frac);
1813 }
1814 }
1815 VERIFY(max_abs_frac < Tp(2.5000000000000020e-13));
1816 }
1817
1818 // Test data for l=50, m=5.
1819 testcase_assoc_legendre<double> data025[] = {
1820 { -0.0000000000000000, 50, 5,
1821 -1.0000000000000000 },
1822 { -27340473.952132788, 50, 5,
1823 -0.90000000000000002 },
1824 { 27753716.768532373, 50, 5,
1825 -0.80000000000000004 },
1826 { 40808153.913493626, 50, 5,
1827 -0.69999999999999996 },
1828 { 32071189.035790101, 50, 5,
1829 -0.59999999999999998 },
1830 { 36265736.218529105, 50, 5,
1831 -0.50000000000000000 },
1832 { 37089596.700204894, 50, 5,
1833 -0.40000000000000002 },
1834 { 14562029.629244510, 50, 5,
1835 -0.30000000000000004 },
1836 { -23686895.217517227, 50, 5,
1837 -0.19999999999999996 },
1838 { -34878992.965676002, 50, 5,
1839 -0.099999999999999978 },
1840 { -0.0000000000000000, 50, 5,
1841 0.0000000000000000 },
1842 { 34878992.965675950, 50, 5,
1843 0.10000000000000009 },
1844 { 23686895.217517227, 50, 5,
1845 0.19999999999999996 },
1846 { -14562029.629244510, 50, 5,
1847 0.30000000000000004 },
1848 { -37089596.700204931, 50, 5,
1849 0.39999999999999991 },
1850 { -36265736.218529105, 50, 5,
1851 0.50000000000000000 },
1852 { -32071189.035790265, 50, 5,
1853 0.60000000000000009 },
1854 { -40808153.913493626, 50, 5,
1855 0.69999999999999996 },
1856 { -27753716.768532373, 50, 5,
1857 0.80000000000000004 },
1858 { 27340473.952133406, 50, 5,
1859 0.89999999999999991 },
1860 { 0.0000000000000000, 50, 5,
1861 1.0000000000000000 },
1862 };
1863
1864 // Test function for l=50, m=5.
1865 template <typename Tp>
1866 void test025()
1867 {
1868 const Tp eps = std::numeric_limits<Tp>::epsilon();
1869 Tp max_abs_diff = -Tp(1);
1870 Tp max_abs_frac = -Tp(1);
1871 unsigned int num_datum = sizeof(data025)
1872 / sizeof(testcase_assoc_legendre<double>);
1873 for (unsigned int i = 0; i < num_datum; ++i)
1874 {
1875 const Tp f = std::tr1::assoc_legendre(Tp(data025[i].l), Tp(data025[i].m),
1876 Tp(data025[i].x));
1877 const Tp f0 = data025[i].f0;
1878 const Tp diff = f - f0;
1879 if (std::abs(diff) > max_abs_diff)
1880 max_abs_diff = std::abs(diff);
1881 if (std::abs(f0) > Tp(10) * eps
1882 && std::abs(f) > Tp(10) * eps)
1883 {
1884 const Tp frac = diff / f0;
1885 if (std::abs(frac) > max_abs_frac)
1886 max_abs_frac = std::abs(frac);
1887 }
1888 }
1889 VERIFY(max_abs_frac < Tp(2.5000000000000020e-13));
1890 }
1891
1892 // Test data for l=50, m=10.
1893 testcase_assoc_legendre<double> data026[] = {
1894 { -0.0000000000000000, 50, 10,
1895 -1.0000000000000000 },
1896 { -8994661710093158.0, 50, 10,
1897 -0.90000000000000002 },
1898 { 932311375306557.00, 50, 10,
1899 -0.80000000000000004 },
1900 { 12153535011507012., 50, 10,
1901 -0.69999999999999996 },
1902 { 12176690755542244., 50, 10,
1903 -0.59999999999999998 },
1904 { 9180035388465752.0, 50, 10,
1905 -0.50000000000000000 },
1906 { 889201701866911.12, 50, 10,
1907 -0.40000000000000002 },
1908 { -9451384032851600.0, 50, 10,
1909 -0.30000000000000004 },
1910 { -9926439446673564.0, 50, 10,
1911 -0.19999999999999996 },
1912 { 2794368162749970.5, 50, 10,
1913 -0.099999999999999978 },
1914 { 11452238249246346., 50, 10,
1915 0.0000000000000000 },
1916 { 2794368162750031.0, 50, 10,
1917 0.10000000000000009 },
1918 { -9926439446673564.0, 50, 10,
1919 0.19999999999999996 },
1920 { -9451384032851600.0, 50, 10,
1921 0.30000000000000004 },
1922 { 889201701866976.25, 50, 10,
1923 0.39999999999999991 },
1924 { 9180035388465752.0, 50, 10,
1925 0.50000000000000000 },
1926 { 12176690755542216., 50, 10,
1927 0.60000000000000009 },
1928 { 12153535011507012., 50, 10,
1929 0.69999999999999996 },
1930 { 932311375306557.00, 50, 10,
1931 0.80000000000000004 },
1932 { -8994661710093322.0, 50, 10,
1933 0.89999999999999991 },
1934 { 0.0000000000000000, 50, 10,
1935 1.0000000000000000 },
1936 };
1937
1938 // Test function for l=50, m=10.
1939 template <typename Tp>
1940 void test026()
1941 {
1942 const Tp eps = std::numeric_limits<Tp>::epsilon();
1943 Tp max_abs_diff = -Tp(1);
1944 Tp max_abs_frac = -Tp(1);
1945 unsigned int num_datum = sizeof(data026)
1946 / sizeof(testcase_assoc_legendre<double>);
1947 for (unsigned int i = 0; i < num_datum; ++i)
1948 {
1949 const Tp f = std::tr1::assoc_legendre(Tp(data026[i].l), Tp(data026[i].m),
1950 Tp(data026[i].x));
1951 const Tp f0 = data026[i].f0;
1952 const Tp diff = f - f0;
1953 if (std::abs(diff) > max_abs_diff)
1954 max_abs_diff = std::abs(diff);
1955 if (std::abs(f0) > Tp(10) * eps
1956 && std::abs(f) > Tp(10) * eps)
1957 {
1958 const Tp frac = diff / f0;
1959 if (std::abs(frac) > max_abs_frac)
1960 max_abs_frac = std::abs(frac);
1961 }
1962 }
1963 VERIFY(max_abs_frac < Tp(1.0000000000000008e-12));
1964 }
1965
1966 // Test data for l=50, m=20.
1967 testcase_assoc_legendre<double> data027[] = {
1968 { 0.0000000000000000, 50, 20,
1969 -1.0000000000000000 },
1970 { 1.6630925158645460e+33, 50, 20,
1971 -0.90000000000000002 },
1972 { 1.0622676657892043e+33, 50, 20,
1973 -0.80000000000000004 },
1974 { 8.6022521164717170e+32, 50, 20,
1975 -0.69999999999999996 },
1976 { 4.0860128756808430e+32, 50, 20,
1977 -0.59999999999999998 },
1978 { -4.0169860814274409e+32, 50, 20,
1979 -0.50000000000000000 },
1980 { -8.2324325279774008e+32, 50, 20,
1981 -0.40000000000000002 },
1982 { -4.0054067236243299e+31, 50, 20,
1983 -0.30000000000000004 },
1984 { 7.9309266056434309e+32, 50, 20,
1985 -0.19999999999999996 },
1986 { 5.4151358290899148e+31, 50, 20,
1987 -0.099999999999999978 },
1988 { -7.8735935697332210e+32, 50, 20,
1989 0.0000000000000000 },
1990 { 5.4151358290895032e+31, 50, 20,
1991 0.10000000000000009 },
1992 { 7.9309266056434309e+32, 50, 20,
1993 0.19999999999999996 },
1994 { -4.0054067236243299e+31, 50, 20,
1995 0.30000000000000004 },
1996 { -8.2324325279773965e+32, 50, 20,
1997 0.39999999999999991 },
1998 { -4.0169860814274409e+32, 50, 20,
1999 0.50000000000000000 },
2000 { 4.0860128756807882e+32, 50, 20,
2001 0.60000000000000009 },
2002 { 8.6022521164717170e+32, 50, 20,
2003 0.69999999999999996 },
2004 { 1.0622676657892043e+33, 50, 20,
2005 0.80000000000000004 },
2006 { 1.6630925158645483e+33, 50, 20,
2007 0.89999999999999991 },
2008 { 0.0000000000000000, 50, 20,
2009 1.0000000000000000 },
2010 };
2011
2012 // Test function for l=50, m=20.
2013 template <typename Tp>
2014 void test027()
2015 {
2016 const Tp eps = std::numeric_limits<Tp>::epsilon();
2017 Tp max_abs_diff = -Tp(1);
2018 Tp max_abs_frac = -Tp(1);
2019 unsigned int num_datum = sizeof(data027)
2020 / sizeof(testcase_assoc_legendre<double>);
2021 for (unsigned int i = 0; i < num_datum; ++i)
2022 {
2023 const Tp f = std::tr1::assoc_legendre(Tp(data027[i].l), Tp(data027[i].m),
2024 Tp(data027[i].x));
2025 const Tp f0 = data027[i].f0;
2026 const Tp diff = f - f0;
2027 if (std::abs(diff) > max_abs_diff)
2028 max_abs_diff = std::abs(diff);
2029 if (std::abs(f0) > Tp(10) * eps
2030 && std::abs(f) > Tp(10) * eps)
2031 {
2032 const Tp frac = diff / f0;
2033 if (std::abs(frac) > max_abs_frac)
2034 max_abs_frac = std::abs(frac);
2035 }
2036 }
2037 VERIFY(max_abs_frac < Tp(1.0000000000000008e-12));
2038 }
2039
2040 // Test data for l=50, m=50.
2041 testcase_assoc_legendre<double> data028[] = {
2042 { 0.0000000000000000, 50, 50,
2043 -1.0000000000000000 },
2044 { 2.5366994974431341e+60, 50, 50,
2045 -0.90000000000000002 },
2046 { 2.2028834403101213e+67, 50, 50,
2047 -0.80000000000000004 },
2048 { 1.3325496559566651e+71, 50, 50,
2049 -0.69999999999999996 },
2050 { 3.8898096431781969e+73, 50, 50,
2051 -0.59999999999999998 },
2052 { 2.0509760257037188e+75, 50, 50,
2053 -0.50000000000000000 },
2054 { 3.4866724533443283e+76, 50, 50,
2055 -0.40000000000000002 },
2056 { 2.5790740224150207e+77, 50, 50,
2057 -0.30000000000000004 },
2058 { 9.8222237931680989e+77, 50, 50,
2059 -0.19999999999999996 },
2060 { 2.1198682190366617e+78, 50, 50,
2061 -0.099999999999999978 },
2062 { 2.7253921397507295e+78, 50, 50,
2063 0.0000000000000000 },
2064 { 2.1198682190366617e+78, 50, 50,
2065 0.10000000000000009 },
2066 { 9.8222237931680989e+77, 50, 50,
2067 0.19999999999999996 },
2068 { 2.5790740224150207e+77, 50, 50,
2069 0.30000000000000004 },
2070 { 3.4866724533443283e+76, 50, 50,
2071 0.39999999999999991 },
2072 { 2.0509760257037188e+75, 50, 50,
2073 0.50000000000000000 },
2074 { 3.8898096431781724e+73, 50, 50,
2075 0.60000000000000009 },
2076 { 1.3325496559566651e+71, 50, 50,
2077 0.69999999999999996 },
2078 { 2.2028834403101213e+67, 50, 50,
2079 0.80000000000000004 },
2080 { 2.5366994974431990e+60, 50, 50,
2081 0.89999999999999991 },
2082 { 0.0000000000000000, 50, 50,
2083 1.0000000000000000 },
2084 };
2085
2086 // Test function for l=50, m=50.
2087 template <typename Tp>
2088 void test028()
2089 {
2090 const Tp eps = std::numeric_limits<Tp>::epsilon();
2091 Tp max_abs_diff = -Tp(1);
2092 Tp max_abs_frac = -Tp(1);
2093 unsigned int num_datum = sizeof(data028)
2094 / sizeof(testcase_assoc_legendre<double>);
2095 for (unsigned int i = 0; i < num_datum; ++i)
2096 {
2097 const Tp f = std::tr1::assoc_legendre(Tp(data028[i].l), Tp(data028[i].m),
2098 Tp(data028[i].x));
2099 const Tp f0 = data028[i].f0;
2100 const Tp diff = f - f0;
2101 if (std::abs(diff) > max_abs_diff)
2102 max_abs_diff = std::abs(diff);
2103 if (std::abs(f0) > Tp(10) * eps
2104 && std::abs(f) > Tp(10) * eps)
2105 {
2106 const Tp frac = diff / f0;
2107 if (std::abs(frac) > max_abs_frac)
2108 max_abs_frac = std::abs(frac);
2109 }
2110 }
2111 VERIFY(max_abs_frac < Tp(2.5000000000000020e-13));
2112 }
2113
2114 // Test data for l=100, m=0.
2115 testcase_assoc_legendre<double> data029[] = {
2116 { 1.0000000000000000, 100, 0,
2117 -1.0000000000000000 },
2118 { 0.10226582055871908, 100, 0,
2119 -0.90000000000000002 },
2120 { 0.050861167913584124, 100, 0,
2121 -0.80000000000000004 },
2122 { -0.077132507199778780, 100, 0,
2123 -0.69999999999999996 },
2124 { -0.023747023905133110, 100, 0,
2125 -0.59999999999999998 },
2126 { -0.060518025961861198, 100, 0,
2127 -0.50000000000000000 },
2128 { -0.072258202125684429, 100, 0,
2129 -0.40000000000000002 },
2130 { 0.057127392202801719, 100, 0,
2131 -0.30000000000000004 },
2132 { 0.014681835355659636, 100, 0,
2133 -0.19999999999999996 },
2134 { -0.063895098434750303, 100, 0,
2135 -0.099999999999999978 },
2136 { 0.079589237387178727, 100, 0,
2137 0.0000000000000000 },
2138 { -0.063895098434749775, 100, 0,
2139 0.10000000000000009 },
2140 { 0.014681835355659636, 100, 0,
2141 0.19999999999999996 },
2142 { 0.057127392202801719, 100, 0,
2143 0.30000000000000004 },
2144 { -0.072258202125685012, 100, 0,
2145 0.39999999999999991 },
2146 { -0.060518025961861198, 100, 0,
2147 0.50000000000000000 },
2148 { -0.023747023905134217, 100, 0,
2149 0.60000000000000009 },
2150 { -0.077132507199778780, 100, 0,
2151 0.69999999999999996 },
2152 { 0.050861167913584124, 100, 0,
2153 0.80000000000000004 },
2154 { 0.10226582055871723, 100, 0,
2155 0.89999999999999991 },
2156 { 1.0000000000000000, 100, 0,
2157 1.0000000000000000 },
2158 };
2159
2160 // Test function for l=100, m=0.
2161 template <typename Tp>
2162 void test029()
2163 {
2164 const Tp eps = std::numeric_limits<Tp>::epsilon();
2165 Tp max_abs_diff = -Tp(1);
2166 Tp max_abs_frac = -Tp(1);
2167 unsigned int num_datum = sizeof(data029)
2168 / sizeof(testcase_assoc_legendre<double>);
2169 for (unsigned int i = 0; i < num_datum; ++i)
2170 {
2171 const Tp f = std::tr1::assoc_legendre(Tp(data029[i].l), Tp(data029[i].m),
2172 Tp(data029[i].x));
2173 const Tp f0 = data029[i].f0;
2174 const Tp diff = f - f0;
2175 if (std::abs(diff) > max_abs_diff)
2176 max_abs_diff = std::abs(diff);
2177 if (std::abs(f0) > Tp(10) * eps
2178 && std::abs(f) > Tp(10) * eps)
2179 {
2180 const Tp frac = diff / f0;
2181 if (std::abs(frac) > max_abs_frac)
2182 max_abs_frac = std::abs(frac);
2183 }
2184 }
2185 VERIFY(max_abs_frac < Tp(2.5000000000000020e-13));
2186 }
2187
2188 // Test data for l=100, m=1.
2189 testcase_assoc_legendre<double> data030[] = {
2190 { -0.0000000000000000, 100, 1,
2191 -1.0000000000000000 },
2192 { 6.5200167187780309, 100, 1,
2193 -0.90000000000000002 },
2194 { 9.0065170007027540, 100, 1,
2195 -0.80000000000000004 },
2196 { -5.4690908541181056, 100, 1,
2197 -0.69999999999999996 },
2198 { -8.6275439170430861, 100, 1,
2199 -0.59999999999999998 },
2200 { -6.0909031663448499, 100, 1,
2201 -0.50000000000000000 },
2202 { 4.1160338699561265, 100, 1,
2203 -0.40000000000000002 },
2204 { 5.8491043010758004, 100, 1,
2205 -0.30000000000000004 },
2206 { -7.9435138723089826, 100, 1,
2207 -0.19999999999999996 },
2208 { 4.7996285823989346, 100, 1,
2209 -0.099999999999999978 },
2210 { 0.0000000000000000, 100, 1,
2211 0.0000000000000000 },
2212 { -4.7996285823990057, 100, 1,
2213 0.10000000000000009 },
2214 { 7.9435138723089826, 100, 1,
2215 0.19999999999999996 },
2216 { -5.8491043010758004, 100, 1,
2217 0.30000000000000004 },
2218 { -4.1160338699560359, 100, 1,
2219 0.39999999999999991 },
2220 { 6.0909031663448499, 100, 1,
2221 0.50000000000000000 },
2222 { 8.6275439170430559, 100, 1,
2223 0.60000000000000009 },
2224 { 5.4690908541181056, 100, 1,
2225 0.69999999999999996 },
2226 { -9.0065170007027540, 100, 1,
2227 0.80000000000000004 },
2228 { -6.5200167187783133, 100, 1,
2229 0.89999999999999991 },
2230 { 0.0000000000000000, 100, 1,
2231 1.0000000000000000 },
2232 };
2233
2234 // Test function for l=100, m=1.
2235 template <typename Tp>
2236 void test030()
2237 {
2238 const Tp eps = std::numeric_limits<Tp>::epsilon();
2239 Tp max_abs_diff = -Tp(1);
2240 Tp max_abs_frac = -Tp(1);
2241 unsigned int num_datum = sizeof(data030)
2242 / sizeof(testcase_assoc_legendre<double>);
2243 for (unsigned int i = 0; i < num_datum; ++i)
2244 {
2245 const Tp f = std::tr1::assoc_legendre(Tp(data030[i].l), Tp(data030[i].m),
2246 Tp(data030[i].x));
2247 const Tp f0 = data030[i].f0;
2248 const Tp diff = f - f0;
2249 if (std::abs(diff) > max_abs_diff)
2250 max_abs_diff = std::abs(diff);
2251 if (std::abs(f0) > Tp(10) * eps
2252 && std::abs(f) > Tp(10) * eps)
2253 {
2254 const Tp frac = diff / f0;
2255 if (std::abs(frac) > max_abs_frac)
2256 max_abs_frac = std::abs(frac);
2257 }
2258 }
2259 VERIFY(max_abs_frac < Tp(5.0000000000000039e-13));
2260 }
2261
2262 // Test data for l=100, m=2.
2263 testcase_assoc_legendre<double> data031[] = {
2264 { 0.0000000000000000, 100, 2,
2265 -1.0000000000000000 },
2266 { -1005.9604880761007, 100, 2,
2267 -0.90000000000000002 },
2268 { -489.68041725865896, 100, 2,
2269 -0.80000000000000004 },
2270 { 768.31676011669970, 100, 2,
2271 -0.69999999999999996 },
2272 { 226.90362556628003, 100, 2,
2273 -0.59999999999999998 },
2274 { 604.19889304940330, 100, 2,
2275 -0.50000000000000000 },
2276 { 733.40061037838029, 100, 2,
2277 -0.40000000000000002 },
2278 { -573.30774483996402, 100, 2,
2279 -0.30000000000000004 },
2280 { -151.52946305080897, 100, 2,
2281 -0.19999999999999996 },
2282 { 646.30525583588019, 100, 2,
2283 -0.099999999999999978 },
2284 { -803.85129761050518, 100, 2,
2285 0.0000000000000000 },
2286 { 646.30525583587439, 100, 2,
2287 0.10000000000000009 },
2288 { -151.52946305080897, 100, 2,
2289 0.19999999999999996 },
2290 { -573.30774483996402, 100, 2,
2291 0.30000000000000004 },
2292 { 733.40061037838507, 100, 2,
2293 0.39999999999999991 },
2294 { 604.19889304940330, 100, 2,
2295 0.50000000000000000 },
2296 { 226.90362556629168, 100, 2,
2297 0.60000000000000009 },
2298 { 768.31676011669970, 100, 2,
2299 0.69999999999999996 },
2300 { -489.68041725865896, 100, 2,
2301 0.80000000000000004 },
2302 { -1005.9604880760811, 100, 2,
2303 0.89999999999999991 },
2304 { 0.0000000000000000, 100, 2,
2305 1.0000000000000000 },
2306 };
2307
2308 // Test function for l=100, m=2.
2309 template <typename Tp>
2310 void test031()
2311 {
2312 const Tp eps = std::numeric_limits<Tp>::epsilon();
2313 Tp max_abs_diff = -Tp(1);
2314 Tp max_abs_frac = -Tp(1);
2315 unsigned int num_datum = sizeof(data031)
2316 / sizeof(testcase_assoc_legendre<double>);
2317 for (unsigned int i = 0; i < num_datum; ++i)
2318 {
2319 const Tp f = std::tr1::assoc_legendre(Tp(data031[i].l), Tp(data031[i].m),
2320 Tp(data031[i].x));
2321 const Tp f0 = data031[i].f0;
2322 const Tp diff = f - f0;
2323 if (std::abs(diff) > max_abs_diff)
2324 max_abs_diff = std::abs(diff);
2325 if (std::abs(f0) > Tp(10) * eps
2326 && std::abs(f) > Tp(10) * eps)
2327 {
2328 const Tp frac = diff / f0;
2329 if (std::abs(frac) > max_abs_frac)
2330 max_abs_frac = std::abs(frac);
2331 }
2332 }
2333 VERIFY(max_abs_frac < Tp(2.5000000000000020e-13));
2334 }
2335
2336 // Test data for l=100, m=5.
2337 testcase_assoc_legendre<double> data032[] = {
2338 { 0.0000000000000000, 100, 5,
2339 -1.0000000000000000 },
2340 { 900551126.09653592, 100, 5,
2341 -0.90000000000000002 },
2342 { 988567431.55756044, 100, 5,
2343 -0.80000000000000004 },
2344 { -645646451.90344620, 100, 5,
2345 -0.69999999999999996 },
2346 { -897114585.29920745, 100, 5,
2347 -0.59999999999999998 },
2348 { -661710744.42483830, 100, 5,
2349 -0.50000000000000000 },
2350 { 380163158.51425594, 100, 5,
2351 -0.40000000000000002 },
2352 { 617391071.36632609, 100, 5,
2353 -0.30000000000000004 },
2354 { -805288801.85509181, 100, 5,
2355 -0.19999999999999996 },
2356 { 481041740.16728652, 100, 5,
2357 -0.099999999999999978 },
2358 { 0.0000000000000000, 100, 5,
2359 0.0000000000000000 },
2360 { -481041740.16729414, 100, 5,
2361 0.10000000000000009 },
2362 { 805288801.85509181, 100, 5,
2363 0.19999999999999996 },
2364 { -617391071.36632609, 100, 5,
2365 0.30000000000000004 },
2366 { -380163158.51424748, 100, 5,
2367 0.39999999999999991 },
2368 { 661710744.42483830, 100, 5,
2369 0.50000000000000000 },
2370 { 897114585.29920506, 100, 5,
2371 0.60000000000000009 },
2372 { 645646451.90344620, 100, 5,
2373 0.69999999999999996 },
2374 { -988567431.55756044, 100, 5,
2375 0.80000000000000004 },
2376 { -900551126.09655809, 100, 5,
2377 0.89999999999999991 },
2378 { 0.0000000000000000, 100, 5,
2379 1.0000000000000000 },
2380 };
2381
2382 // Test function for l=100, m=5.
2383 template <typename Tp>
2384 void test032()
2385 {
2386 const Tp eps = std::numeric_limits<Tp>::epsilon();
2387 Tp max_abs_diff = -Tp(1);
2388 Tp max_abs_frac = -Tp(1);
2389 unsigned int num_datum = sizeof(data032)
2390 / sizeof(testcase_assoc_legendre<double>);
2391 for (unsigned int i = 0; i < num_datum; ++i)
2392 {
2393 const Tp f = std::tr1::assoc_legendre(Tp(data032[i].l), Tp(data032[i].m),
2394 Tp(data032[i].x));
2395 const Tp f0 = data032[i].f0;
2396 const Tp diff = f - f0;
2397 if (std::abs(diff) > max_abs_diff)
2398 max_abs_diff = std::abs(diff);
2399 if (std::abs(f0) > Tp(10) * eps
2400 && std::abs(f) > Tp(10) * eps)
2401 {
2402 const Tp frac = diff / f0;
2403 if (std::abs(frac) > max_abs_frac)
2404 max_abs_frac = std::abs(frac);
2405 }
2406 }
2407 VERIFY(max_abs_frac < Tp(2.5000000000000020e-13));
2408 }
2409
2410 // Test data for l=100, m=10.
2411 testcase_assoc_legendre<double> data033[] = {
2412 { 0.0000000000000000, 100, 10,
2413 -1.0000000000000000 },
2414 { 2.5643395957658915e+17, 100, 10,
2415 -0.90000000000000002 },
2416 { 1.5778673545673316e+18, 100, 10,
2417 -0.80000000000000004 },
2418 { 4.4355048487496776e+18, 100, 10,
2419 -0.69999999999999996 },
2420 { -9.5936111659124493e+17, 100, 10,
2421 -0.59999999999999998 },
2422 { 4.2387123021963372e+18, 100, 10,
2423 -0.50000000000000000 },
2424 { 8.2370834618426563e+18, 100, 10,
2425 -0.40000000000000002 },
2426 { -4.9089358388052890e+18, 100, 10,
2427 -0.30000000000000004 },
2428 { -2.3468810358091279e+18, 100, 10,
2429 -0.19999999999999996 },
2430 { 6.8627855225034568e+18, 100, 10,
2431 -0.099999999999999978 },
2432 { -8.2494597181670380e+18, 100, 10,
2433 0.0000000000000000 },
2434 { 6.8627855225034056e+18, 100, 10,
2435 0.10000000000000009 },
2436 { -2.3468810358091279e+18, 100, 10,
2437 0.19999999999999996 },
2438 { -4.9089358388052890e+18, 100, 10,
2439 0.30000000000000004 },
2440 { 8.2370834618426747e+18, 100, 10,
2441 0.39999999999999991 },
2442 { 4.2387123021963372e+18, 100, 10,
2443 0.50000000000000000 },
2444 { -9.5936111659112115e+17, 100, 10,
2445 0.60000000000000009 },
2446 { 4.4355048487496776e+18, 100, 10,
2447 0.69999999999999996 },
2448 { 1.5778673545673316e+18, 100, 10,
2449 0.80000000000000004 },
2450 { 2.5643395957690282e+17, 100, 10,
2451 0.89999999999999991 },
2452 { 0.0000000000000000, 100, 10,
2453 1.0000000000000000 },
2454 };
2455
2456 // Test function for l=100, m=10.
2457 template <typename Tp>
2458 void test033()
2459 {
2460 const Tp eps = std::numeric_limits<Tp>::epsilon();
2461 Tp max_abs_diff = -Tp(1);
2462 Tp max_abs_frac = -Tp(1);
2463 unsigned int num_datum = sizeof(data033)
2464 / sizeof(testcase_assoc_legendre<double>);
2465 for (unsigned int i = 0; i < num_datum; ++i)
2466 {
2467 const Tp f = std::tr1::assoc_legendre(Tp(data033[i].l), Tp(data033[i].m),
2468 Tp(data033[i].x));
2469 const Tp f0 = data033[i].f0;
2470 const Tp diff = f - f0;
2471 if (std::abs(diff) > max_abs_diff)
2472 max_abs_diff = std::abs(diff);
2473 if (std::abs(f0) > Tp(10) * eps
2474 && std::abs(f) > Tp(10) * eps)
2475 {
2476 const Tp frac = diff / f0;
2477 if (std::abs(frac) > max_abs_frac)
2478 max_abs_frac = std::abs(frac);
2479 }
2480 }
2481 VERIFY(max_abs_frac < Tp(2.5000000000000014e-11));
2482 }
2483
2484 // Test data for l=100, m=20.
2485 testcase_assoc_legendre<double> data034[] = {
2486 { 0.0000000000000000, 100, 20,
2487 -1.0000000000000000 },
2488 { 7.1604344878778576e+37, 100, 20,
2489 -0.90000000000000002 },
2490 { -8.3963895116962035e+38, 100, 20,
2491 -0.80000000000000004 },
2492 { 7.9022236853110024e+38, 100, 20,
2493 -0.69999999999999996 },
2494 { 8.2680005574120908e+38, 100, 20,
2495 -0.59999999999999998 },
2496 { 3.0750497039999469e+38, 100, 20,
2497 -0.50000000000000000 },
2498 { -7.6120586043843874e+38, 100, 20,
2499 -0.40000000000000002 },
2500 { 1.1474496891901873e+38, 100, 20,
2501 -0.30000000000000004 },
2502 { 4.3966251307444218e+38, 100, 20,
2503 -0.19999999999999996 },
2504 { -7.0503266451702621e+38, 100, 20,
2505 -0.099999999999999978 },
2506 { 7.7727439836159581e+38, 100, 20,
2507 0.0000000000000000 },
2508 { -7.0503266451702213e+38, 100, 20,
2509 0.10000000000000009 },
2510 { 4.3966251307444218e+38, 100, 20,
2511 0.19999999999999996 },
2512 { 1.1474496891901873e+38, 100, 20,
2513 0.30000000000000004 },
2514 { -7.6120586043843511e+38, 100, 20,
2515 0.39999999999999991 },
2516 { 3.0750497039999469e+38, 100, 20,
2517 0.50000000000000000 },
2518 { 8.2680005574120424e+38, 100, 20,
2519 0.60000000000000009 },
2520 { 7.9022236853110024e+38, 100, 20,
2521 0.69999999999999996 },
2522 { -8.3963895116962035e+38, 100, 20,
2523 0.80000000000000004 },
2524 { 7.1604344878809460e+37, 100, 20,
2525 0.89999999999999991 },
2526 { 0.0000000000000000, 100, 20,
2527 1.0000000000000000 },
2528 };
2529
2530 // Test function for l=100, m=20.
2531 template <typename Tp>
2532 void test034()
2533 {
2534 const Tp eps = std::numeric_limits<Tp>::epsilon();
2535 Tp max_abs_diff = -Tp(1);
2536 Tp max_abs_frac = -Tp(1);
2537 unsigned int num_datum = sizeof(data034)
2538 / sizeof(testcase_assoc_legendre<double>);
2539 for (unsigned int i = 0; i < num_datum; ++i)
2540 {
2541 const Tp f = std::tr1::assoc_legendre(Tp(data034[i].l), Tp(data034[i].m),
2542 Tp(data034[i].x));
2543 const Tp f0 = data034[i].f0;
2544 const Tp diff = f - f0;
2545 if (std::abs(diff) > max_abs_diff)
2546 max_abs_diff = std::abs(diff);
2547 if (std::abs(f0) > Tp(10) * eps
2548 && std::abs(f) > Tp(10) * eps)
2549 {
2550 const Tp frac = diff / f0;
2551 if (std::abs(frac) > max_abs_frac)
2552 max_abs_frac = std::abs(frac);
2553 }
2554 }
2555 VERIFY(max_abs_frac < Tp(2.5000000000000015e-12));
2556 }
2557
2558 // Test data for l=100, m=50.
2559 testcase_assoc_legendre<double> data035[] = {
2560 { 0.0000000000000000, 100, 50,
2561 -1.0000000000000000 },
2562 { 9.3231278516893773e+96, 100, 50,
2563 -0.90000000000000002 },
2564 { -1.1029797977454331e+98, 100, 50,
2565 -0.80000000000000004 },
2566 { 1.8089333903465883e+97, 100, 50,
2567 -0.69999999999999996 },
2568 { 5.9364045925669389e+97, 100, 50,
2569 -0.59999999999999998 },
2570 { -8.2252620339727163e+97, 100, 50,
2571 -0.50000000000000000 },
2572 { 7.1431385093739848e+97, 100, 50,
2573 -0.40000000000000002 },
2574 { -3.3520602067479374e+97, 100, 50,
2575 -0.30000000000000004 },
2576 { -2.7791149588121386e+97, 100, 50,
2577 -0.19999999999999996 },
2578 { 9.0119338550180433e+97, 100, 50,
2579 -0.099999999999999978 },
2580 { -1.1712145031578381e+98, 100, 50,
2581 0.0000000000000000 },
2582 { 9.0119338550181176e+97, 100, 50,
2583 0.10000000000000009 },
2584 { -2.7791149588121386e+97, 100, 50,
2585 0.19999999999999996 },
2586 { -3.3520602067479374e+97, 100, 50,
2587 0.30000000000000004 },
2588 { 7.1431385093740728e+97, 100, 50,
2589 0.39999999999999991 },
2590 { -8.2252620339727163e+97, 100, 50,
2591 0.50000000000000000 },
2592 { 5.9364045925668061e+97, 100, 50,
2593 0.60000000000000009 },
2594 { 1.8089333903465883e+97, 100, 50,
2595 0.69999999999999996 },
2596 { -1.1029797977454331e+98, 100, 50,
2597 0.80000000000000004 },
2598 { 9.3231278516894892e+96, 100, 50,
2599 0.89999999999999991 },
2600 { 0.0000000000000000, 100, 50,
2601 1.0000000000000000 },
2602 };
2603
2604 // Test function for l=100, m=50.
2605 template <typename Tp>
2606 void test035()
2607 {
2608 const Tp eps = std::numeric_limits<Tp>::epsilon();
2609 Tp max_abs_diff = -Tp(1);
2610 Tp max_abs_frac = -Tp(1);
2611 unsigned int num_datum = sizeof(data035)
2612 / sizeof(testcase_assoc_legendre<double>);
2613 for (unsigned int i = 0; i < num_datum; ++i)
2614 {
2615 const Tp f = std::tr1::assoc_legendre(Tp(data035[i].l), Tp(data035[i].m),
2616 Tp(data035[i].x));
2617 const Tp f0 = data035[i].f0;
2618 const Tp diff = f - f0;
2619 if (std::abs(diff) > max_abs_diff)
2620 max_abs_diff = std::abs(diff);
2621 if (std::abs(f0) > Tp(10) * eps
2622 && std::abs(f) > Tp(10) * eps)
2623 {
2624 const Tp frac = diff / f0;
2625 if (std::abs(frac) > max_abs_frac)
2626 max_abs_frac = std::abs(frac);
2627 }
2628 }
2629 VERIFY(max_abs_frac < Tp(1.0000000000000008e-12));
2630 }
2631
2632 // Test data for l=100, m=100.
2633 testcase_assoc_legendre<double> data036[] = {
2634 { 0.0000000000000000, 100, 100,
2635 -1.0000000000000000 },
2636 { 5.7751792255758316e+150, 100, 100,
2637 -0.90000000000000002 },
2638 { 4.3552236041585515e+164, 100, 100,
2639 -0.80000000000000004 },
2640 { 1.5936546850595123e+172, 100, 100,
2641 -0.69999999999999996 },
2642 { 1.3579510590289176e+177, 100, 100,
2643 -0.59999999999999998 },
2644 { 3.7752749682889513e+180, 100, 100,
2645 -0.50000000000000000 },
2646 { 1.0910627330458913e+183, 100, 100,
2647 -0.40000000000000002 },
2648 { 5.9697347526822483e+184, 100, 100,
2649 -0.30000000000000004 },
2650 { 8.6585879147526714e+185, 100, 100,
2651 -0.19999999999999996 },
2652 { 4.0331571908057011e+186, 100, 100,
2653 -0.099999999999999978 },
2654 { 6.6663086700729543e+186, 100, 100,
2655 0.0000000000000000 },
2656 { 4.0331571908057011e+186, 100, 100,
2657 0.10000000000000009 },
2658 { 8.6585879147526714e+185, 100, 100,
2659 0.19999999999999996 },
2660 { 5.9697347526822483e+184, 100, 100,
2661 0.30000000000000004 },
2662 { 1.0910627330458913e+183, 100, 100,
2663 0.39999999999999991 },
2664 { 3.7752749682889513e+180, 100, 100,
2665 0.50000000000000000 },
2666 { 1.3579510590289000e+177, 100, 100,
2667 0.60000000000000009 },
2668 { 1.5936546850595123e+172, 100, 100,
2669 0.69999999999999996 },
2670 { 4.3552236041585515e+164, 100, 100,
2671 0.80000000000000004 },
2672 { 5.7751792255761289e+150, 100, 100,
2673 0.89999999999999991 },
2674 { 0.0000000000000000, 100, 100,
2675 1.0000000000000000 },
2676 };
2677
2678 // Test function for l=100, m=100.
2679 template <typename Tp>
2680 void test036()
2681 {
2682 const Tp eps = std::numeric_limits<Tp>::epsilon();
2683 Tp max_abs_diff = -Tp(1);
2684 Tp max_abs_frac = -Tp(1);
2685 unsigned int num_datum = sizeof(data036)
2686 / sizeof(testcase_assoc_legendre<double>);
2687 for (unsigned int i = 0; i < num_datum; ++i)
2688 {
2689 const Tp f = std::tr1::assoc_legendre(Tp(data036[i].l), Tp(data036[i].m),
2690 Tp(data036[i].x));
2691 const Tp f0 = data036[i].f0;
2692 const Tp diff = f - f0;
2693 if (std::abs(diff) > max_abs_diff)
2694 max_abs_diff = std::abs(diff);
2695 if (std::abs(f0) > Tp(10) * eps
2696 && std::abs(f) > Tp(10) * eps)
2697 {
2698 const Tp frac = diff / f0;
2699 if (std::abs(frac) > max_abs_frac)
2700 max_abs_frac = std::abs(frac);
2701 }
2702 }
2703 VERIFY(max_abs_frac < Tp(2.5000000000000020e-13));
2704 }
2705
2706 int main(int, char**)
2707 {
2708 test001<double>();
2709 test002<double>();
2710 test003<double>();
2711 test004<double>();
2712 test005<double>();
2713 test006<double>();
2714 test007<double>();
2715 test008<double>();
2716 test009<double>();
2717 test010<double>();
2718 test011<double>();
2719 test012<double>();
2720 test013<double>();
2721 test014<double>();
2722 test015<double>();
2723 test016<double>();
2724 test017<double>();
2725 test018<double>();
2726 test019<double>();
2727 test020<double>();
2728 test021<double>();
2729 test022<double>();
2730 test023<double>();
2731 test024<double>();
2732 test025<double>();
2733 test026<double>();
2734 test027<double>();
2735 test028<double>();
2736 test029<double>();
2737 test030<double>();
2738 test031<double>();
2739 test032<double>();
2740 test033<double>();
2741 test034<double>();
2742 test035<double>();
2743 test036<double>();
2744 return 0;
2745 }