1 /* (C) Copyright John Maddock 2008.
2 Use, modification and distribution are subject to the
3 Boost Software License, Version 1.0. (See accompanying file
4 LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5 */
6
7 #include <math.h>
8 #include <float.h>
9 #include <stdio.h>
10
11 #include <boost/math/tr1.hpp>
12
13 unsigned errors = 0;
14
check_close_f(float v1,float v2,float tol,int line)15 void check_close_f(float v1, float v2, float tol, int line)
16 {
17 float err;
18 if((v1 == 0) || (v2 ==0))
19 {
20 err = fabsf(v1 - v2);
21 }
22 else
23 {
24 err = fabsf((v1 - v2) / v2);
25 }
26 if(err * 100 > tol)
27 {
28 errors += 1;
29 printf("Error at line %d, with error %e (max allowed %e)\n", line, (double)err, (double)(tol / 100));
30 }
31 }
check_close(double v1,double v2,double tol,int line)32 void check_close(double v1, double v2, double tol, int line)
33 {
34 double err;
35 if((v1 == 0) || (v2 ==0))
36 {
37 err = fabs(v1 - v2);
38 }
39 else
40 {
41 err = fabs((v1 - v2) / v2);
42 }
43 if(err * 100 > tol)
44 {
45 errors += 1;
46 printf("Error at line %d, with error %e (max allowed %e)\n", line, (double)err, (double)(tol / 100));
47 }
48 }
check_close_l(long double v1,long double v2,long double tol,int line)49 void check_close_l(long double v1, long double v2, long double tol, int line)
50 {
51 long double err;
52 if((v1 == 0) || (v2 ==0))
53 {
54 err = fabsl(v1 - v2);
55 }
56 else
57 {
58 err = fabsl((v1 - v2) / v2);
59 }
60 if(err * 100 > tol)
61 {
62 errors += 1;
63 printf("Error at line %d, with error %e (max allowed %e)\n", line, (double)err, (double)(tol / 100));
64 }
65 }
66
check(int b,int line)67 void check(int b, int line)
68 {
69 if(b == 0)
70 {
71 errors += 1;
72 printf("Error at line %d\n", line);
73 }
74 }
75
check_close_fraction_f(float v1,float v2,float tol,int line)76 void check_close_fraction_f(float v1, float v2, float tol, int line)
77 {
78 check_close_f(v1, v2, tol * 100, line);
79 }
check_close_fraction(double v1,double v2,double tol,int line)80 void check_close_fraction(double v1, double v2, double tol, int line)
81 {
82 check_close(v1, v2, tol * 100, line);
83 }
check_close_fraction_l(long double v1,long double v2,long double tol,int line)84 void check_close_fraction_l(long double v1, long double v2, long double tol, int line)
85 {
86 check_close_l(v1, v2, tol * 100, line);
87 }
88
test_values_f(const char * name)89 void test_values_f(const char* name)
90 {
91 #ifndef TEST_LD
92 //
93 // First the C99 math functions:
94 //
95 float eps = FLT_EPSILON;
96 float sv;
97 check_close_f(acoshf(coshf(0.5f)), 0.5f, 5000 * eps, __LINE__);
98 check_close_f(asinhf(sinhf(0.5f)), 0.5f, 5000 * eps, __LINE__);
99 check_close_f(atanhf(tanhf(0.5f)), 0.5f, 5000 * eps, __LINE__);
100
101 check_close_f(cbrtf(1.5f * 1.5f * 1.5f), 1.5f, 5000 * eps, __LINE__);
102
103 check(copysignf(1.0f, 1.0f) == 1.0f, __LINE__);
104 check(copysignf(1.0f, -1.0f) == -1.0f, __LINE__);
105 check(copysignf(-1.0f, 1.0f) == 1.0f, __LINE__);
106 check(copysignf(-1.0f, -1.0f) == -1.0f, __LINE__);
107
108 check_close_f(erfcf(0.125), 0.85968379519866618260697055347837660181302041685015f, eps * 1000, __LINE__);
109 check_close_f(erfcf(0.5), 0.47950012218695346231725334610803547126354842424204f, eps * 1000, __LINE__);
110 check_close_f(erfcf(1), 0.15729920705028513065877936491739074070393300203370f, eps * 1000, __LINE__);
111 check_close_f(erfcf(5), 1.5374597944280348501883434853833788901180503147234e-12f, eps * 1000, __LINE__);
112 check_close_f(erfcf(-0.125), 1.1403162048013338173930294465216233981869795831498f, eps * 1000, __LINE__);
113 check_close_f(erfcf(-0.5), 1.5204998778130465376827466538919645287364515757580f, eps * 1000, __LINE__);
114 check_close_f(erfcf(0), 1, eps * 1000, __LINE__);
115
116 check_close_f(erff(0.125), 0.14031620480133381739302944652162339818697958314985f, eps * 1000, __LINE__);
117 check_close_f(erff(0.5), 0.52049987781304653768274665389196452873645157575796f, eps * 1000, __LINE__);
118 check_close_f(erff(1), 0.84270079294971486934122063508260925929606699796630f, eps * 1000, __LINE__);
119 check_close_f(erff(5), 0.9999999999984625402055719651498116565146166211099f, eps * 1000, __LINE__);
120 check_close_f(erff(-0.125), -0.14031620480133381739302944652162339818697958314985f, eps * 1000, __LINE__);
121 check_close_f(erff(-0.5), -0.52049987781304653768274665389196452873645157575796f, eps * 1000, __LINE__);
122 check_close_f(erff(0), 0, eps * 1000, __LINE__);
123
124 check_close_f(log1pf(0.582029759883880615234375e0), 0.4587086807259736626531803258754840111707e0f, eps * 1000, __LINE__);
125 check_close_f(expm1f(0.582029759883880615234375e0), 0.7896673415707786528734865994546559029663e0f, eps * 1000, __LINE__);
126 check_close_f(log1pf(-0.2047410048544406890869140625e-1), -0.2068660038044094868521052319477265955827e-1f, eps * 1000, __LINE__);
127 check_close_f(expm1f(-0.2047410048544406890869140625e-1), -0.2026592921724753704129022027337835687888e-1f, eps * 1000, __LINE__);
128
129 check_close_f(fmaxf(0.1f, -0.1f), 0.1f, 0, __LINE__);
130 check_close_f(fminf(0.1f, -0.1f), -0.1f, 0, __LINE__);
131
132 check_close_f(hypotf(1.0f, 3.0f), sqrtf(10.0f), eps * 500, __LINE__);
133
134 check_close_f(lgammaf(3.5), 1.2009736023470742248160218814507129957702389154682f, 5000 * eps, __LINE__);
135 check_close_f(lgammaf(0.125), 2.0194183575537963453202905211670995899482809521344f, 5000 * eps, __LINE__);
136 check_close_f(lgammaf(-0.125), 2.1653002489051702517540619481440174064962195287626f, 5000 * eps, __LINE__);
137 check_close_f(lgammaf(-3.125), 0.1543111276840418242676072830970532952413339012367f, 5000 * eps, __LINE__);
138 check_close_f(lgammaf(-53249.0/1024), -149.43323093420259741100038126078721302600128285894f, 5000 * eps, __LINE__);
139
140 check_close_f(tgammaf(3.5), 3.3233509704478425511840640312646472177454052302295f, 5000 * eps, __LINE__);
141 check_close_f(tgammaf(0.125), 7.5339415987976119046992298412151336246104195881491f, 5000 * eps, __LINE__);
142 check_close_f(tgammaf(-0.125), -8.7172188593831756100190140408231437691829605421405f, 5000 * eps, __LINE__);
143 check_close_f(tgammaf(-3.125), 1.1668538708507675587790157356605097019141636072094f, 5000 * eps, __LINE__);
144
145 #ifdef BOOST_HAS_LONG_LONG
146 check(llroundf(2.5f) == 3fL, __LINE__);
147 check(llroundf(2.25f) == 2fL, __LINE__);
148 #endif
149 check(lroundf(2.5f) == 3.0f, __LINE__);
150 check(lroundf(2.25f) == 2.0f, __LINE__);
151 check(roundf(2.5f) == 3.0f, __LINE__);
152 check(roundf(2.25f) == 2.0f, __LINE__);
153
154 check(nextafterf(1.0f, 2.0f) > 1.0f, __LINE__);
155 check(nextafterf(1.0f, -2.0f) < 1.0f, __LINE__);
156 check(nextafterf(nextafterf(1.0f, 2.0f), -2.0f) == 1.0f, __LINE__);
157 check(nextafterf(nextafterf(1.0f, -2.0f), 2.0f) == 1.0f, __LINE__);
158 check(nextafterf(1.0f, 2.0f) > 1.0f, __LINE__);
159 check(nextafterf(1.0f, -2.0f) < 1.0f, __LINE__);
160 check(nextafterf(nextafterf(1.0f, 2.0f), -2.0f) == 1.0f, __LINE__);
161 check(nextafterf(nextafterf(1.0f, -2.0f), 2.0f) == 1.0f, __LINE__);
162
163 check(truncf(2.5f) == 2.0f, __LINE__);
164 check(truncf(2.25f) == 2.0f, __LINE__);
165
166 //
167 // Now for the TR1 math functions:
168 //
169 check_close_fraction_f(assoc_laguerref(4, 5, 0.5f), 88.31510416666666666666666666666666666667f, eps * 100, __LINE__);
170 check_close_fraction_f(assoc_laguerref(10, 0, 2.5f), -0.8802526766660982969576719576719576719577f, eps * 100, __LINE__);
171 check_close_fraction_f(assoc_laguerref(10, 1, 4.5f), 1.564311458042689732142857142857142857143f, eps * 100, __LINE__);
172 check_close_fraction_f(assoc_laguerref(10, 6, 8.5f), 20.51596541066649098875661375661375661376f, eps * 100, __LINE__);
173 check_close_fraction_f(assoc_laguerref(10, 12, 12.5f), -199.5560968456234671241181657848324514991f, eps * 100, __LINE__);
174 check_close_fraction_f(assoc_laguerref(50, 40, 12.5f), -4.996769495006119488583146995907246595400e16f, eps * 100, __LINE__);
175
176 check_close_fraction_f(laguerref(1, 0.5f), 0.5f, eps * 100, __LINE__);
177 check_close_fraction_f(laguerref(4, 0.5f), -0.3307291666666666666666666666666666666667f, eps * 100, __LINE__);
178 check_close_fraction_f(laguerref(7, 0.5f), -0.5183392237103174603174603174603174603175f, eps * 100, __LINE__);
179 check_close_fraction_f(laguerref(20, 0.5f), 0.3120174870800154148915399248893113634676f, eps * 100, __LINE__);
180 check_close_fraction_f(laguerref(50, 0.5f), -0.3181388060269979064951118308575628226834f, eps * 100, __LINE__);
181
182 check_close_fraction_f(laguerref(1, -0.5f), 1.5f, eps * 100, __LINE__);
183 check_close_fraction_f(laguerref(4, -0.5f), 3.835937500000000000000000000000000000000f, eps * 100, __LINE__);
184 check_close_fraction_f(laguerref(7, -0.5f), 7.950934709821428571428571428571428571429f, eps * 100, __LINE__);
185 check_close_fraction_f(laguerref(20, -0.5f), 76.12915699869631476833699787070874048223f, eps * 100, __LINE__);
186 check_close_fraction_f(laguerref(50, -0.5f), 2307.428631277506570629232863491518399720f, eps * 100, __LINE__);
187
188 check_close_fraction_f(laguerref(1, 4.5f), -3.500000000000000000000000000000000000000f, eps * 100, __LINE__);
189 check_close_fraction_f(laguerref(4, 4.5f), 0.08593750000000000000000000000000000000000f, eps * 100, __LINE__);
190 check_close_fraction_f(laguerref(7, 4.5f), -1.036928013392857142857142857142857142857f, eps * 100, __LINE__);
191 check_close_fraction_f(laguerref(20, 4.5f), 1.437239150257817378525582974722170737587f, eps * 100, __LINE__);
192 check_close_fraction_f(laguerref(50, 4.5f), -0.7795068145562651416494321484050019245248f, eps * 100, __LINE__);
193
194 check_close_fraction_f(assoc_legendref(4, 2, 0.5f), 4.218750000000000000000000000000000000000f, eps * 100, __LINE__);
195 check_close_fraction_f(assoc_legendref(7, 5, 0.5f), 5696.789530152175143607977274672800795328f, eps * 100, __LINE__);
196 check_close_fraction_f(assoc_legendref(4, 2, -0.5f), 4.218750000000000000000000000000000000000f, eps * 100, __LINE__);
197 check_close_fraction_f(assoc_legendref(7, 5, -0.5f), 5696.789530152175143607977274672800795328f, eps * 100, __LINE__);
198
199 check_close_fraction_f(legendref(1, 0.5f), 0.5f, eps * 100, __LINE__);
200 check_close_fraction_f(legendref(4, 0.5f), -0.2890625000000000000000000000000000000000f, eps * 100, __LINE__);
201 check_close_fraction_f(legendref(7, 0.5f), 0.2231445312500000000000000000000000000000f, eps * 100, __LINE__);
202 check_close_fraction_f(legendref(40, 0.5f), -0.09542943523261546936538467572384923220258f, eps * 100, __LINE__);
203
204 sv = eps / 1024;
205 check_close_f(betaf(1, 1), 1, eps * 20 * 100, __LINE__);
206 check_close_f(betaf(1, 4), 0.25, eps * 20 * 100, __LINE__);
207 check_close_f(betaf(4, 1), 0.25, eps * 20 * 100, __LINE__);
208 check_close_f(betaf(sv, 4), 1/sv, eps * 20 * 100, __LINE__);
209 check_close_f(betaf(4, sv), 1/sv, eps * 20 * 100, __LINE__);
210 check_close_f(betaf(4, 20), 0.00002823263692828910220214568040654997176736f, eps * 20 * 100, __LINE__);
211 check_close_f(betaf(0.0125f, 0.000023f), 43558.24045647538375006349016083320744662f, eps * 20 * 100, __LINE__);
212
213 check_close_f(comp_ellint_1f(0), 1.5707963267948966192313216916397514420985846996876f, eps * 5000, __LINE__);
214 check_close_f(comp_ellint_1f(0.125), 1.5769867712158131421244030532288080803822271060839f, eps * 5000, __LINE__);
215 check_close_f(comp_ellint_1f(0.25), 1.5962422221317835101489690714979498795055744578951f, eps * 5000, __LINE__);
216 check_close_f(comp_ellint_1f(300/1024.0f), 1.6062331054696636704261124078746600894998873503208f, eps * 5000, __LINE__);
217 check_close_f(comp_ellint_1f(400/1024.0f), 1.6364782007562008756208066125715722889067992997614f, eps * 5000, __LINE__);
218 check_close_f(comp_ellint_1f(-0.5), 1.6857503548125960428712036577990769895008008941411f, eps * 5000, __LINE__);
219 check_close_f(comp_ellint_1f(-0.75), 1.9109897807518291965531482187613425592531451316788f, eps * 5000, __LINE__);
220
221 check_close_f(comp_ellint_2f(-1), 1.0f, eps * 5000, __LINE__);
222 check_close_f(comp_ellint_2f(0), 1.5707963267948966192313216916397514420985846996876f, eps * 5000, __LINE__);
223 check_close_f(comp_ellint_2f(100 / 1024.0f), 1.5670445330545086723323795143598956428788609133377f, eps * 5000, __LINE__);
224 check_close_f(comp_ellint_2f(200 / 1024.0f), 1.5557071588766556854463404816624361127847775545087f, eps * 5000, __LINE__);
225 check_close_f(comp_ellint_2f(300 / 1024.0f), 1.5365278991162754883035625322482669608948678755743f, eps * 5000, __LINE__);
226 check_close_f(comp_ellint_2f(400 / 1024.0f), 1.5090417763083482272165682786143770446401437564021f, eps * 5000, __LINE__);
227 check_close_f(comp_ellint_2f(-0.5), 1.4674622093394271554597952669909161360253617523272f, eps * 5000, __LINE__);
228 check_close_f(comp_ellint_2f(-600 / 1024.0f), 1.4257538571071297192428217218834579920545946473778f, eps * 5000, __LINE__);
229 check_close_f(comp_ellint_2f(-800 / 1024.0f), 1.2927868476159125056958680222998765985004489572909f, eps * 5000, __LINE__);
230 check_close_f(comp_ellint_2f(-900 / 1024.0f), 1.1966864890248739524112920627353824133420353430982f, eps * 5000, __LINE__);
231
232 check_close_f(comp_ellint_3f(0.2f, 0), 1.586867847454166237308008033828114192951f, eps * 5000, __LINE__);
233 check_close_f(comp_ellint_3f(0.4f, 0), 1.639999865864511206865258329748601457626f, eps * 5000, __LINE__);
234 check_close_f(comp_ellint_3f(0.0f, 0), 1.57079632679489661923132169163975144209858469968755291048747f, eps * 5000, __LINE__);
235 check_close_f(comp_ellint_3f(0.0f, 0.5), 2.221441469079183123507940495030346849307f, eps * 5000, __LINE__);
236 check_close_f(comp_ellint_3f(0.3f, -4), 0.712708870925620061597924858162260293305195624270730660081949f, eps * 5000, __LINE__);
237 check_close_f(comp_ellint_3f(-0.5f, -1e+05), 0.00496944596485066055800109163256108604615568144080386919012831f, eps * 5000, __LINE__);
238 check_close_f(comp_ellint_3f(-0.75f, -1e+10), 0.0000157080225184890546939710019277357161497407143903832703317801f, eps * 5000, __LINE__);
239 check_close_f(comp_ellint_3f(-0.875f, 1 / 1024.0f), 2.18674503176462374414944618968850352696579451638002110619287f, eps * 5000, __LINE__);
240 check_close_f(comp_ellint_3f(-0.875f, 1023/1024.0f), 101.045289804941384100960063898569538919135722087486350366997f, eps * 5000, __LINE__);
241
242 check_close_f(cyl_bessel_if(2.25f, 1/(1024.0f*1024.0f)), 2.34379212133481347189068464680335815256364262507955635911656e-15f, eps * 5000, __LINE__);
243 check_close_f(cyl_bessel_if(5.5f, 3.125), 0.0583514045989371500460946536220735787163510569634133670181210f, eps * 5000, __LINE__);
244 check_close_f(cyl_bessel_if(-5 + 1.0f/1024.0f, 2.125), 0.0267920938009571023702933210070984416052633027166975342895062f, eps * 5000, __LINE__);
245 check_close_f(cyl_bessel_if(-5.5f, 10), 597.577606961369169607937419869926705730305175364662688426534f, eps * 5000, __LINE__);
246 check_close_f(cyl_bessel_if(-10486074.0f/(1024.0f*1024), 1/1024.0f), 1.41474005665181350367684623930576333542989766867888186478185e35f, eps * 5000, __LINE__);
247 check_close_f(cyl_bessel_if(-10486074.0f/(1024.0f*1024), 50), 1.07153277202900671531087024688681954238311679648319534644743e20f, eps * 5000, __LINE__);
248 check_close_f(cyl_bessel_if(144794.0f/1024.0f, 100), 2066.27694757392660413922181531984160871678224178890247540320f, eps * 5000, __LINE__);
249 check_close_f(cyl_bessel_if(-144794.0f/1024.0f, 100), 2066.27694672763190927440969155740243346136463461655104698748f, eps * 5000, __LINE__);
250
251 check_close_f(cyl_bessel_jf(2457/1024.0f, 1/1024.0f), 3.80739920118603335646474073457326714709615200130620574875292e-9f, eps * 5000, __LINE__);
252 check_close_f(cyl_bessel_jf(5.5f, 3217.0f/1024), 0.0281933076257506091621579544064767140470089107926550720453038f, eps * 5000, __LINE__);
253 check_close_f(cyl_bessel_jf(-5.5f, 3217.0f/1024), -2.55820064470647911823175836997490971806135336759164272675969f, eps * 5000, __LINE__);
254 check_close_f(cyl_bessel_jf(-5.5f, 1e+04), 2.449843111985605522111159013846599118397e-03f, eps * 5000, __LINE__);
255 check_close_f(cyl_bessel_jf(5.5f, 1e+04), 0.00759343502722670361395585198154817047185480147294665270646578f, eps * 5000, __LINE__);
256 check_close_f(cyl_bessel_jf(5.5f, 1e+06), -0.000747424248595630177396350688505919533097973148718960064663632f, eps * 5000, __LINE__);
257 check_close_f(cyl_bessel_jf(5.125f, 1e+06), -0.000776600124835704280633640911329691642748783663198207360238214f, eps * 5000, __LINE__);
258 check_close_f(cyl_bessel_jf(5.875f, 1e+06), -0.000466322721115193071631008581529503095819705088484386434589780f, eps * 5000, __LINE__);
259 check_close_f(cyl_bessel_jf(0.5f, 101), 0.0358874487875643822020496677692429287863419555699447066226409f, eps * 5000, __LINE__);
260 check_close_f(cyl_bessel_jf(-5.5f, 1e+04), 0.00244984311198560552211115901384659911839737686676766460822577f, eps * 5000, __LINE__);
261 check_close_f(cyl_bessel_jf(-5.5f, 1e+06), 0.000279243200433579511095229508894156656558211060453622750659554f, eps * 5000, __LINE__);
262 check_close_f(cyl_bessel_jf(-0.5f, 101), 0.0708184798097594268482290389188138201440114881159344944791454f, eps * 5000, __LINE__);
263 check_close_f(cyl_bessel_jf(-10486074 / (1024*1024.0f), 1/1024.0f), 1.41474013160494695750009004222225969090304185981836460288562e35f, eps * 5000, __LINE__);
264 check_close_f(cyl_bessel_jf(-10486074 / (1024*1024.0f), 15), -0.0902239288885423309568944543848111461724911781719692852541489f, eps * 5000, __LINE__);
265 check_close_f(cyl_bessel_jf(10486074 / (1024*1024.0f), 1e+02f), -0.0547064914615137807616774867984047583596945624129838091326863f, eps * 5000, __LINE__);
266 check_close_f(cyl_bessel_jf(10486074 / (1024*1024.0f), 2e+04f), -0.00556783614400875611650958980796060611309029233226596737701688f, eps * 5000, __LINE__);
267 check_close_f(cyl_bessel_jf(-10486074 / (1024*1024.0f), 1e+02f), -0.0547613660316806551338637153942604550779513947674222863858713f, eps * 5000, __LINE__);
268
269 check_close_f(cyl_bessel_kf(0.5f, 0.875), 0.558532231646608646115729767013630967055657943463362504577189f, eps * 5000, __LINE__);
270 check_close_f(cyl_bessel_kf(0.5f, 1.125), 0.383621010650189547146769320487006220295290256657827220786527f, eps * 5000, __LINE__);
271 check_close_f(cyl_bessel_kf(2.25f, ldexpf(1.0f, -30)), 5.62397392719283271332307799146649700147907612095185712015604e20f, eps * 5000, __LINE__);
272 check_close_f(cyl_bessel_kf(5.5f, 3217/1024.0f), 1.30623288775012596319554857587765179889689223531159532808379f, eps * 5000, __LINE__);
273 check_close_f(cyl_bessel_kf(-5.5f, 10), 0.0000733045300798502164644836879577484533096239574909573072142667f, eps * 5000, __LINE__);
274 check_close_f(cyl_bessel_kf(-5.5f, 100), 5.41274555306792267322084448693957747924412508020839543293369e-45f, eps * 5000, __LINE__);
275 check_close_f(cyl_bessel_kf(10240/1024.0f, 1/1024.0f), 2.35522579263922076203415803966825431039900000000993410734978e38f, eps * 5000, __LINE__);
276 check_close_f(cyl_bessel_kf(10240/1024.0f, 10), 0.00161425530039067002345725193091329085443750382929208307802221f, eps * 5000, __LINE__);
277 check_close_f(cyl_bessel_kf(144793/1024.0f, 100), 1.39565245860302528069481472855619216759142225046370312329416e-6f, eps * 5000, __LINE__);
278 check_close_f(cyl_bessel_kf(144793/1024.0f, 200), 0.0f, eps * 5000, __LINE__);
279
280 check_close_f(cyl_neumannf(0.5f, 1 / (1024.0f*1024)), -817.033790261762580469303126467917092806755460418223776544122f, eps * 5000, __LINE__);
281 check_close_f(cyl_neumannf(5.5f, 3.125), -2.61489440328417468776474188539366752698192046890955453259866f, eps * 5000, __LINE__);
282 check_close_f(cyl_neumannf(-5.5f, 3.125), -0.0274994493896489729948109971802244976377957234563871795364056f, eps * 5000, __LINE__);
283 check_close_f(cyl_neumannf(-5.5f, 1e+04), -0.00759343502722670361395585198154817047185480147294665270646578f, eps * 5000, __LINE__);
284 check_close_f(cyl_neumannf(-10486074 / (1024*1024.0f), 1/1024.0f), -1.50382374389531766117868938966858995093408410498915220070230e38f, eps * 5000, __LINE__);
285 check_close_f(cyl_neumannf(-10486074 / (1024*1024.0f), 1e+02f), 0.0583041891319026009955779707640455341990844522293730214223545f, eps * 5000, __LINE__);
286 check_close_f(cyl_neumannf(141.75f, 1e+02), -5.38829231428696507293191118661269920130838607482708483122068e9f, eps * 5000, __LINE__);
287 check_close_f(cyl_neumannf(141.75f, 2e+04), -0.00376577888677186194728129112270988602876597726657372330194186f, eps * 5000, __LINE__);
288 check_close_f(cyl_neumannf(-141.75f, 1e+02), -3.81009803444766877495905954105669819951653361036342457919021e9f, eps * 5000, __LINE__);
289
290 check_close_f(ellint_1f(0, 0), 0, eps * 5000, __LINE__);
291 check_close_f(ellint_1f(0, -10), -10, eps * 5000, __LINE__);
292 check_close_f(ellint_1f(-1, -1), -1.2261911708835170708130609674719067527242483502207f, eps * 5000, __LINE__);
293 check_close_f(ellint_1f(0.875f, -4), -5.3190556182262405182189463092940736859067548232647f, eps * 5000, __LINE__);
294 check_close_f(ellint_1f(-0.625f, 8), 9.0419973860310100524448893214394562615252527557062f, eps * 5000, __LINE__);
295 check_close_f(ellint_1f(0.875f, 1e-05f), 0.000010000000000127604166668510945638036143355898993088f, eps * 5000, __LINE__);
296 check_close_f(ellint_1f(10/1024.0f, 1e+05f), 100002.38431454899771096037307519328741455615271038f, eps * 5000, __LINE__);
297 check_close_f(ellint_1f(1, 1e-20f), 1.0000000000000000000000000000000000000000166666667e-20f, eps * 5000, __LINE__);
298 check_close_f(ellint_1f(1e-20f, 1e-20f), 1.000000000000000e-20f, eps * 5000, __LINE__);
299 check_close_f(ellint_1f(400/1024.0f, 1e+20f), 1.0418143796499216839719289963154558027005142709763e20f, eps * 5000, __LINE__);
300 check_close_f(ellint_1f(0.5f, 2), 2.1765877052210673672479877957388515321497888026770f, eps * 5000, __LINE__);
301 check_close_f(ellint_1f(0.5f, 4), 4.2543274975235836861894752787874633017836785640477f, eps * 5000, __LINE__);
302 check_close_f(ellint_1f(0.5f, 6), 6.4588766202317746302999080620490579800463614807916f, eps * 5000, __LINE__);
303 check_close_f(ellint_1f(0.5f, 10), 10.697409951222544858346795279378531495869386960090f, eps * 5000, __LINE__);
304 check_close_f(ellint_1f(0.5f, -2), -2.1765877052210673672479877957388515321497888026770f, eps * 5000, __LINE__);
305 check_close_f(ellint_1f(0.5f, -4), -4.2543274975235836861894752787874633017836785640477f, eps * 5000, __LINE__);
306 check_close_f(ellint_1f(0.5f, -6), -6.4588766202317746302999080620490579800463614807916f, eps * 5000, __LINE__);
307 check_close_f(ellint_1f(0.5f, -10), -10.697409951222544858346795279378531495869386960090f, eps * 5000, __LINE__);
308
309 check_close_f(ellint_2f(0, 0), 0, eps * 5000, __LINE__);
310 check_close_f(ellint_2f(0, -10), -10, eps * 5000, __LINE__);
311 check_close_f(ellint_2f(-1, -1), -0.84147098480789650665250232163029899962256306079837f, eps * 5000, __LINE__);
312 check_close_f(ellint_2f(900 / 1024.0f, -4), -3.1756145986492562317862928524528520686391383168377f, eps * 5000, __LINE__);
313 check_close_f(ellint_2f(-600 / 1024.0f, 8), 7.2473147180505693037677015377802777959345489333465f, eps * 5000, __LINE__);
314 check_close_f(ellint_2f(800 / 1024.0f, 1e-05f), 9.999999999898274739584436515967055859383969942432E-6f, eps * 5000, __LINE__);
315 check_close_f(ellint_2f(100 / 1024.0f, 1e+05f), 99761.153306972066658135668386691227343323331995888f, eps * 5000, __LINE__);
316 check_close_f(ellint_2f(-0.5f, 1e+10f), 9.3421545766487137036576748555295222252286528414669e9f, eps * 5000, __LINE__);
317 check_close_f(ellint_2f(400 / 1024.0f, ldexpf(1, 66)), 7.0886102721911705466476846969992069994308167515242e19f, eps * 5000, __LINE__);
318
319 check_close_f(ellint_3f(0, 1, -1), -1.557407724654902230506974807458360173087f, eps * 5000, __LINE__);
320 check_close_f(ellint_3f(0.4f, 0, -4), -4.153623371196831087495427530365430979011f, eps * 5000, __LINE__);
321 check_close_f(ellint_3f(-0.6f, 0, 8), 8.935930619078575123490612395578518914416f, eps * 5000, __LINE__);
322 check_close_f(ellint_3f(0.25f, 0, 0.5f), 0.501246705365439492445236118603525029757890291780157969500480f, eps * 5000, __LINE__);
323 check_close_f(ellint_3f(0, 0, 0.5f), 0.5f, eps * 5000, __LINE__);
324 check_close_f(ellint_3f(0, -2, 0.5f), 0.437501067017546278595664813509803743009132067629603474488486f, eps * 5000, __LINE__);
325 check_close_f(ellint_3f(0, 0.25f, 0.5f), 0.510269830229213412212501938035914557628394166585442994564135f, eps * 5000, __LINE__);
326 check_close_f(ellint_3f(0, 0.75f, 0.5f), 0.533293253875952645421201146925578536430596894471541312806165f, eps * 5000, __LINE__);
327 check_close_f(ellint_3f(0, 0.75f, 0.75), 0.871827580412760575085768367421866079353646112288567703061975f, eps * 5000, __LINE__);
328 check_close_f(ellint_3f(0, 1, 0.25f), 0.255341921221036266504482236490473678204201638800822621740476f, eps * 5000, __LINE__);
329 check_close_f(ellint_3f(0, 2, 0.25f), 0.261119051639220165094943572468224137699644963125853641716219f, eps * 5000, __LINE__);
330 check_close_f(ellint_3f(0, 1023/1024.0f, 1.5), 13.2821612239764190363647953338544569682942329604483733197131f, eps * 5000, __LINE__);
331 check_close_f(ellint_3f(0.5f, 0.5f, -1), -1.228014414316220642611298946293865487807f, eps * 5000, __LINE__);
332 check_close_f(ellint_3f(0.5f, 0.5f, 1e+10f), 1.536591003599172091573590441336982730551e+10f, eps * 5000, __LINE__);
333 check_close_f(ellint_3f(0.75f, -1e+05f, 10), 0.0347926099493147087821620459290460547131012904008557007934290f, eps * 5000, __LINE__);
334 check_close_f(ellint_3f(0.875f, -1e+10f, 10), 0.000109956202759561502329123384755016959364346382187364656768212f, eps * 5000, __LINE__);
335 check_close_f(ellint_3f(0.875f, -1e+10f, 1e+20f), 1.00000626665567332602765201107198822183913978895904937646809e15f, eps * 5000, __LINE__);
336 check_close_f(ellint_3f(0.875f, -1e+10f, 1608/1024.0f), 0.0000157080616044072676127333183571107873332593142625043567690379f, eps * 5000, __LINE__);
337 check_close_f(ellint_3f(0.875f, 1-1 / 1024.0f, 1e+20f), 6.43274293944380717581167058274600202023334985100499739678963e21f, eps * 5000, __LINE__);
338 check_close_f(ellint_3f(0.25f, 50, 0.1f), 0.124573770342749525407523258569507331686458866564082916835900f, eps * 5000, __LINE__);
339 check_close_f(ellint_3f(0.25f, 1.125f, 1), 1.77299767784815770192352979665283069318388205110727241629752f, eps * 5000, __LINE__);
340
341 check_close_f(expintf(1/1024.0f), -6.35327933972759151358547423727042905862963067106751711596065f, eps * 5000, __LINE__);
342 check_close_f(expintf(0.125), -1.37320852494298333781545045921206470808223543321810480716122f, eps * 5000, __LINE__);
343 check_close_f(expintf(0.5), 0.454219904863173579920523812662802365281405554352642045162818f, eps * 5000, __LINE__);
344 check_close_f(expintf(1), 1.89511781635593675546652093433163426901706058173270759164623f, eps * 5000, __LINE__);
345 check_close_f(expintf(50.5), 1.72763195602911805201155668940185673806099654090456049881069e20f, eps * 5000, __LINE__);
346 check_close_f(expintf(-1/1024.0f), -6.35523246483107180261445551935803221293763008553775821607264f, eps * 5000, __LINE__);
347 check_close_f(expintf(-0.125), -1.62342564058416879145630692462440887363310605737209536579267f, eps * 5000, __LINE__);
348 check_close_f(expintf(-0.5), -0.559773594776160811746795939315085235226846890316353515248293f, eps * 5000, __LINE__);
349 check_close_f(expintf(-1), -0.219383934395520273677163775460121649031047293406908207577979f, eps * 5000, __LINE__);
350 check_close_f(expintf(-50.5), -2.27237132932219350440719707268817831250090574830769670186618e-24f, eps * 5000, __LINE__);
351
352 check_close_fraction_f(hermitef(0, 1), 1.L, 100 * eps, __LINE__);
353 check_close_fraction_f(hermitef(1, 1), 2.L, 100 * eps, __LINE__);
354 check_close_fraction_f(hermitef(1, 2), 4.L, 100 * eps, __LINE__);
355 check_close_fraction_f(hermitef(1, 10), 20, 100 * eps, __LINE__);
356 check_close_fraction_f(hermitef(1, 100), 200, 100 * eps, __LINE__);
357 check_close_fraction_f(hermitef(1, 1e6), 2e6f, 100 * eps, __LINE__);
358 check_close_fraction_f(hermitef(10, 30), 5.896624628001300E+17f, 100 * eps, __LINE__);
359 check_close_fraction_f(hermitef(10, 1000), 1.023976960161280E+33f, 100 * eps, __LINE__);
360 check_close_fraction_f(hermitef(10, 10), 8.093278209760000E+12f, 100 * eps, __LINE__);
361 check_close_fraction_f(hermitef(10, -10), 8.093278209760000E+12f, 100 * eps, __LINE__);
362 check_close_fraction_f(hermitef(3, -10), -7.880000000000000E+3f, 100 * eps, __LINE__);
363 check_close_fraction_f(hermitef(3, -1000), -7.999988000000000E+9f, 100 * eps, __LINE__);
364 check_close_fraction_f(hermitef(3, -1000000), -7.999999999988000E+18f, 100 * eps, __LINE__);
365
366 check_close_f(riemann_zetaf(0.125), -0.63277562349869525529352526763564627152686379131122f, eps * 5000, __LINE__);
367 check_close_f(riemann_zetaf(1023 / 1024.0f), -1023.4228554489429786541032870895167448906103303056f, eps * 5000, __LINE__);
368 check_close_f(riemann_zetaf(1025 / 1024.0f), 1024.5772867695045940578681624248887776501597556226f, eps * 5000, __LINE__);
369 check_close_f(riemann_zetaf(0.5f), -1.46035450880958681288949915251529801246722933101258149054289f, eps * 5000, __LINE__);
370 check_close_f(riemann_zetaf(1.125f), 8.5862412945105752999607544082693023591996301183069f, eps * 5000, __LINE__);
371 check_close_f(riemann_zetaf(2), 1.6449340668482264364724151666460251892189499012068f, eps * 5000, __LINE__);
372 check_close_f(riemann_zetaf(3.5f), 1.1267338673170566464278124918549842722219969574036f, eps * 5000, __LINE__);
373 check_close_f(riemann_zetaf(4), 1.08232323371113819151600369654116790277475095191872690768298f, eps * 5000, __LINE__);
374 check_close_f(riemann_zetaf(4 + 1 / 1024.0f), 1.08225596856391369799036835439238249195298434901488518878804f, eps * 5000, __LINE__);
375 check_close_f(riemann_zetaf(4.5f), 1.05470751076145426402296728896028011727249383295625173068468f, eps * 5000, __LINE__);
376 check_close_f(riemann_zetaf(6.5f), 1.01200589988852479610078491680478352908773213619144808841031f, eps * 5000, __LINE__);
377 check_close_f(riemann_zetaf(7.5f), 1.00582672753652280770224164440459408011782510096320822989663f, eps * 5000, __LINE__);
378 check_close_f(riemann_zetaf(8.125f), 1.0037305205308161603183307711439385250181080293472f, eps * 5000, __LINE__);
379 check_close_f(riemann_zetaf(16.125f), 1.0000140128224754088474783648500235958510030511915f, eps * 5000, __LINE__);
380 check_close_f(riemann_zetaf(0), -0.5f, eps * 5000, __LINE__);
381 check_close_f(riemann_zetaf(-0.125f), -0.39906966894504503550986928301421235400280637468895f, eps * 5000, __LINE__);
382 check_close_f(riemann_zetaf(-1), -0.083333333333333333333333333333333333333333333333333f, eps * 5000, __LINE__);
383 check_close_f(riemann_zetaf(-2), 0, eps * 5000, __LINE__);
384 check_close_f(riemann_zetaf(-2.5f), 0.0085169287778503305423585670283444869362759902200745f, eps * 5000 * 3, __LINE__);
385 check_close_f(riemann_zetaf(-3), 0.0083333333333333333333333333333333333333333333333333f, eps * 5000, __LINE__);
386 check_close_f(riemann_zetaf(-4), 0, eps * 5000, __LINE__);
387 check_close_f(riemann_zetaf(-20), 0, eps * 5000 * 100, __LINE__);
388 check_close_f(riemann_zetaf(-21), -281.46014492753623188405797101449275362318840579710f, eps * 5000 * 100, __LINE__);
389 check_close_f(riemann_zetaf(-30.125f), 2.2762941726834511267740045451463455513839970804578e7f, eps * 5000 * 100, __LINE__);
390
391 check_close_f(sph_besself(0, 0.1433600485324859619140625e-1f), 0.9999657468461303487880990241993035937654e0f, eps * 5000 * 100, __LINE__);
392 check_close_f(sph_besself(0, 0.1760916970670223236083984375e-1f), 0.9999483203249623334100130061926184665364e0f, eps * 5000 * 100, __LINE__);
393 check_close_f(sph_besself(2, 0.1433600485324859619140625e-1f), 0.1370120120703995134662099191103188366059e-4f, eps * 5000 * 100, __LINE__);
394 check_close_f(sph_besself(2, 0.1760916970670223236083984375e-1f), 0.2067173265753174063228459655801741280461e-4f, eps * 5000 * 100, __LINE__);
395 check_close_f(sph_besself(7, 0.1252804412841796875e3f), 0.7887555711993028736906736576314283291289e-2f, eps * 5000 * 100, __LINE__);
396 check_close_f(sph_besself(7, 0.25554705810546875e3f), -0.1463292767579579943284849187188066532514e-2f, eps * 5000 * 100, __LINE__);
397
398 check_close_f(sph_neumannf(0, 0.408089816570281982421875e0f), -0.2249212131304610409189209411089291558038e1f, eps * 5000 * 100, __LINE__);
399 check_close_f(sph_neumannf(0, 0.6540834903717041015625e0f), -0.1213309779166084571756446746977955970241e1f, eps * 5000 * 100, __LINE__);
400 check_close_f(sph_neumannf(2, 0.408089816570281982421875e0f), -0.4541702641837159203058389758895634766256e2f, eps * 5000 * 100, __LINE__);
401 check_close_f(sph_neumannf(2, 0.6540834903717041015625e0f), -0.1156112621471167110574129561700037138981e2f, eps * 5000 * 100, __LINE__);
402 check_close_f(sph_neumannf(10, 0.1097540378570556640625e1f), -0.2427889658115064857278886600528596240123e9f, eps * 5000 * 100, __LINE__);
403 check_close_f(sph_neumannf(10, 0.30944411754608154296875e1f), -0.3394649246350136450439882104151313759251e4f, eps * 5000 * 100, __LINE__);
404
405 check_close_fraction_f(sph_legendref(3, 2, 0.5f), 0.2061460599687871330692286791802688341213f, eps * 5000, __LINE__);
406 check_close_fraction_f(sph_legendref(40, 15, 0.75f), -0.406036847302819452666908966769096223205057182668333862900509f, eps * 5000, __LINE__);
407
408 #endif
409 }
410
test_values(const char * name)411 void test_values(const char* name)
412 {
413 #ifndef TEST_LD
414 //
415 // First the C99 math functions:
416 //
417 double eps = DBL_EPSILON;
418 double sv;
419 check_close(acosh(cosh(0.5)), 0.5, 5000 * eps, __LINE__);
420 check_close(asinh(sinh(0.5)), 0.5, 5000 * eps, __LINE__);
421 check_close(atanh(tanh(0.5)), 0.5, 5000 * eps, __LINE__);
422
423 check_close(cbrt(1.5 * 1.5 * 1.5), 1.5, 5000 * eps, __LINE__);
424
425 check(copysign(1.0, 1.0) == 1.0, __LINE__);
426 check(copysign(1.0, -1.0) == -1.0, __LINE__);
427 check(copysign(-1.0, 1.0) == 1.0, __LINE__);
428 check(copysign(-1.0, -1.0) == -1.0, __LINE__);
429
430 check_close(erfc(0.125), 0.85968379519866618260697055347837660181302041685015, eps * 1000, __LINE__);
431 check_close(erfc(0.5), 0.47950012218695346231725334610803547126354842424204, eps * 1000, __LINE__);
432 check_close(erfc(1), 0.15729920705028513065877936491739074070393300203370, eps * 1000, __LINE__);
433 check_close(erfc(5), 1.5374597944280348501883434853833788901180503147234e-12, eps * 1000, __LINE__);
434 check_close(erfc(-0.125), 1.1403162048013338173930294465216233981869795831498, eps * 1000, __LINE__);
435 check_close(erfc(-0.5), 1.5204998778130465376827466538919645287364515757580, eps * 1000, __LINE__);
436 check_close(erfc(0), 1, eps * 1000, __LINE__);
437
438 check_close(erf(0.125), 0.14031620480133381739302944652162339818697958314985, eps * 1000, __LINE__);
439 check_close(erf(0.5), 0.52049987781304653768274665389196452873645157575796, eps * 1000, __LINE__);
440 check_close(erf(1), 0.84270079294971486934122063508260925929606699796630, eps * 1000, __LINE__);
441 check_close(erf(5), 0.9999999999984625402055719651498116565146166211099, eps * 1000, __LINE__);
442 check_close(erf(-0.125), -0.14031620480133381739302944652162339818697958314985, eps * 1000, __LINE__);
443 check_close(erf(-0.5), -0.52049987781304653768274665389196452873645157575796, eps * 1000, __LINE__);
444 check_close(erf(0), 0, eps * 1000, __LINE__);
445
446 check_close(log1p(0.582029759883880615234375e0), 0.4587086807259736626531803258754840111707e0, eps * 1000, __LINE__);
447 check_close(expm1(0.582029759883880615234375e0), 0.7896673415707786528734865994546559029663e0, eps * 1000, __LINE__);
448 check_close(log1p(-0.2047410048544406890869140625e-1), -0.2068660038044094868521052319477265955827e-1, eps * 1000, __LINE__);
449 check_close(expm1(-0.2047410048544406890869140625e-1), -0.2026592921724753704129022027337835687888e-1, eps * 1000, __LINE__);
450
451 check_close(fmax(0.1, -0.1), 0.1, 0, __LINE__);
452 check_close(fmin(0.1, -0.1), -0.1, 0, __LINE__);
453
454 check_close(hypot(1.0, 3.0), sqrt(10.0), eps * 500, __LINE__);
455
456 check_close(lgamma(3.5), 1.2009736023470742248160218814507129957702389154682, 5000 * eps, __LINE__);
457 check_close(lgamma(0.125), 2.0194183575537963453202905211670995899482809521344, 5000 * eps, __LINE__);
458 check_close(lgamma(-0.125), 2.1653002489051702517540619481440174064962195287626, 5000 * eps, __LINE__);
459 check_close(lgamma(-3.125), 0.1543111276840418242676072830970532952413339012367, 5000 * eps, __LINE__);
460 check_close(lgamma(-53249.0/1024), -149.43323093420259741100038126078721302600128285894, 5000 * eps, __LINE__);
461
462 check_close(tgamma(3.5), 3.3233509704478425511840640312646472177454052302295, 5000 * eps, __LINE__);
463 check_close(tgamma(0.125), 7.5339415987976119046992298412151336246104195881491, 5000 * eps, __LINE__);
464 check_close(tgamma(-0.125), -8.7172188593831756100190140408231437691829605421405, 5000 * eps, __LINE__);
465 check_close(tgamma(-3.125), 1.1668538708507675587790157356605097019141636072094, 5000 * eps, __LINE__);
466
467 #ifdef BOOST_HAS_LONG_LONG
468 check(llround(2.5) == 3L, __LINE__);
469 check(llround(2.25) == 2L, __LINE__);
470 #endif
471 check(lround(2.5) == 3.0, __LINE__);
472 check(lround(2.25) == 2.0, __LINE__);
473 check(round(2.5) == 3.0, __LINE__);
474 check(round(2.25) == 2.0, __LINE__);
475
476 check(nextafter(1.0, 2.0) > 1.0, __LINE__);
477 check(nextafter(1.0, -2.0) < 1.0, __LINE__);
478 check(nextafter(nextafter(1.0, 2.0), -2.0) == 1.0, __LINE__);
479 check(nextafter(nextafter(1.0, -2.0), 2.0) == 1.0, __LINE__);
480 check(nextafter(1.0, 2.0) > 1.0, __LINE__);
481 check(nextafter(1.0, -2.0) < 1.0, __LINE__);
482 check(nextafter(nextafter(1.0, 2.0), -2.0) == 1.0, __LINE__);
483 check(nextafter(nextafter(1.0, -2.0), 2.0) == 1.0, __LINE__);
484
485 check(trunc(2.5) == 2.0, __LINE__);
486 check(trunc(2.25) == 2.0, __LINE__);
487
488 //
489 // Now for the TR1 math functions:
490 //
491 check_close_fraction(assoc_laguerre(4, 5, 0.5), 88.31510416666666666666666666666666666667, eps * 100, __LINE__);
492 check_close_fraction(assoc_laguerre(10, 0, 2.5), -0.8802526766660982969576719576719576719577, eps * 100, __LINE__);
493 check_close_fraction(assoc_laguerre(10, 1, 4.5), 1.564311458042689732142857142857142857143, eps * 100, __LINE__);
494 check_close_fraction(assoc_laguerre(10, 6, 8.5), 20.51596541066649098875661375661375661376, eps * 100, __LINE__);
495 check_close_fraction(assoc_laguerre(10, 12, 12.5), -199.5560968456234671241181657848324514991, eps * 100, __LINE__);
496 check_close_fraction(assoc_laguerre(50, 40, 12.5), -4.996769495006119488583146995907246595400e16, eps * 100, __LINE__);
497
498 check_close_fraction(laguerre(1, 0.5), 0.5, eps * 100, __LINE__);
499 check_close_fraction(laguerre(4, 0.5), -0.3307291666666666666666666666666666666667, eps * 100, __LINE__);
500 check_close_fraction(laguerre(7, 0.5), -0.5183392237103174603174603174603174603175, eps * 100, __LINE__);
501 check_close_fraction(laguerre(20, 0.5), 0.3120174870800154148915399248893113634676, eps * 100, __LINE__);
502 check_close_fraction(laguerre(50, 0.5), -0.3181388060269979064951118308575628226834, eps * 100, __LINE__);
503
504 check_close_fraction(laguerre(1, -0.5), 1.5, eps * 100, __LINE__);
505 check_close_fraction(laguerre(4, -0.5), 3.835937500000000000000000000000000000000, eps * 100, __LINE__);
506 check_close_fraction(laguerre(7, -0.5), 7.950934709821428571428571428571428571429, eps * 100, __LINE__);
507 check_close_fraction(laguerre(20, -0.5), 76.12915699869631476833699787070874048223, eps * 100, __LINE__);
508 check_close_fraction(laguerre(50, -0.5), 2307.428631277506570629232863491518399720, eps * 100, __LINE__);
509
510 check_close_fraction(laguerre(1, 4.5), -3.500000000000000000000000000000000000000, eps * 100, __LINE__);
511 check_close_fraction(laguerre(4, 4.5), 0.08593750000000000000000000000000000000000, eps * 100, __LINE__);
512 check_close_fraction(laguerre(7, 4.5), -1.036928013392857142857142857142857142857, eps * 100, __LINE__);
513 check_close_fraction(laguerre(20, 4.5), 1.437239150257817378525582974722170737587, eps * 100, __LINE__);
514 check_close_fraction(laguerre(50, 4.5), -0.7795068145562651416494321484050019245248, eps * 100, __LINE__);
515
516 check_close_fraction(assoc_legendre(4, 2, 0.5), 4.218750000000000000000000000000000000000, eps * 100, __LINE__);
517 check_close_fraction(assoc_legendre(7, 5, 0.5), 5696.789530152175143607977274672800795328, eps * 100, __LINE__);
518 check_close_fraction(assoc_legendre(4, 2, -0.5), 4.218750000000000000000000000000000000000, eps * 100, __LINE__);
519 check_close_fraction(assoc_legendre(7, 5, -0.5), 5696.789530152175143607977274672800795328, eps * 100, __LINE__);
520
521 check_close_fraction(legendre(1, 0.5), 0.5, eps * 100, __LINE__);
522 check_close_fraction(legendre(4, 0.5), -0.2890625000000000000000000000000000000000, eps * 100, __LINE__);
523 check_close_fraction(legendre(7, 0.5), 0.2231445312500000000000000000000000000000, eps * 100, __LINE__);
524 check_close_fraction(legendre(40, 0.5), -0.09542943523261546936538467572384923220258, eps * 100, __LINE__);
525
526 sv = eps / 1024;
527 check_close(beta(1, 1), 1, eps * 20 * 100, __LINE__);
528 check_close(beta(1, 4), 0.25, eps * 20 * 100, __LINE__);
529 check_close(beta(4, 1), 0.25, eps * 20 * 100, __LINE__);
530 check_close(beta(sv, 4), 1/sv, eps * 20 * 100, __LINE__);
531 check_close(beta(4, sv), 1/sv, eps * 20 * 100, __LINE__);
532 check_close(beta(4, 20), 0.00002823263692828910220214568040654997176736, eps * 20 * 100, __LINE__);
533 check_close(beta(0.0125, 0.000023), 43558.24045647538375006349016083320744662, eps * 20 * 100, __LINE__);
534
535 check_close(comp_ellint_1(0), 1.5707963267948966192313216916397514420985846996876, eps * 5000, __LINE__);
536 check_close(comp_ellint_1(0.125), 1.5769867712158131421244030532288080803822271060839, eps * 5000, __LINE__);
537 check_close(comp_ellint_1(0.25), 1.5962422221317835101489690714979498795055744578951, eps * 5000, __LINE__);
538 check_close(comp_ellint_1(300/1024.0), 1.6062331054696636704261124078746600894998873503208, eps * 5000, __LINE__);
539 check_close(comp_ellint_1(400/1024.0), 1.6364782007562008756208066125715722889067992997614, eps * 5000, __LINE__);
540 check_close(comp_ellint_1(-0.5), 1.6857503548125960428712036577990769895008008941411, eps * 5000, __LINE__);
541 check_close(comp_ellint_1(-0.75), 1.9109897807518291965531482187613425592531451316788, eps * 5000, __LINE__);
542
543 check_close(comp_ellint_2(-1), 1.0, eps * 5000, __LINE__);
544 check_close(comp_ellint_2(0), 1.5707963267948966192313216916397514420985846996876, eps * 5000, __LINE__);
545 check_close(comp_ellint_2(100 / 1024.0), 1.5670445330545086723323795143598956428788609133377, eps * 5000, __LINE__);
546 check_close(comp_ellint_2(200 / 1024.0), 1.5557071588766556854463404816624361127847775545087, eps * 5000, __LINE__);
547 check_close(comp_ellint_2(300 / 1024.0), 1.5365278991162754883035625322482669608948678755743, eps * 5000, __LINE__);
548 check_close(comp_ellint_2(400 / 1024.0), 1.5090417763083482272165682786143770446401437564021, eps * 5000, __LINE__);
549 check_close(comp_ellint_2(-0.5), 1.4674622093394271554597952669909161360253617523272, eps * 5000, __LINE__);
550 check_close(comp_ellint_2(-600 / 1024.0), 1.4257538571071297192428217218834579920545946473778, eps * 5000, __LINE__);
551 check_close(comp_ellint_2(-800 / 1024.0), 1.2927868476159125056958680222998765985004489572909, eps * 5000, __LINE__);
552 check_close(comp_ellint_2(-900 / 1024.0), 1.1966864890248739524112920627353824133420353430982, eps * 5000, __LINE__);
553
554 check_close(comp_ellint_3(0.2, 0), 1.586867847454166237308008033828114192951, eps * 5000, __LINE__);
555 check_close(comp_ellint_3(0.4, 0), 1.639999865864511206865258329748601457626, eps * 5000, __LINE__);
556 check_close(comp_ellint_3(0.0, 0), 1.57079632679489661923132169163975144209858469968755291048747, eps * 5000, __LINE__);
557 check_close(comp_ellint_3(0.0, 0.5), 2.221441469079183123507940495030346849307, eps * 5000, __LINE__);
558 check_close(comp_ellint_3(0.3, -4), 0.712708870925620061597924858162260293305195624270730660081949, eps * 5000, __LINE__);
559 check_close(comp_ellint_3(-0.5, -1e+05), 0.00496944596485066055800109163256108604615568144080386919012831, eps * 5000, __LINE__);
560 check_close(comp_ellint_3(-0.75, -1e+10), 0.0000157080225184890546939710019277357161497407143903832703317801, eps * 5000, __LINE__);
561 check_close(comp_ellint_3(-0.875, 1 / 1024.0), 2.18674503176462374414944618968850352696579451638002110619287, eps * 5000, __LINE__);
562 check_close(comp_ellint_3(-0.875, 1023/1024.0), 101.045289804941384100960063898569538919135722087486350366997, eps * 5000, __LINE__);
563
564 check_close(cyl_bessel_i(2.25, 1/(1024.0*1024.0)), 2.34379212133481347189068464680335815256364262507955635911656e-15, eps * 5000, __LINE__);
565 check_close(cyl_bessel_i(5.5, 3.125), 0.0583514045989371500460946536220735787163510569634133670181210, eps * 5000, __LINE__);
566 check_close(cyl_bessel_i(-5 + 1.0/1024.0, 2.125), 0.0267920938009571023702933210070984416052633027166975342895062, eps * 5000, __LINE__);
567 check_close(cyl_bessel_i(-5.5, 10), 597.577606961369169607937419869926705730305175364662688426534, eps * 5000, __LINE__);
568 check_close(cyl_bessel_i(-10486074.0/(1024.0*1024), 1/1024.0), 1.41474005665181350367684623930576333542989766867888186478185e35, eps * 5000, __LINE__);
569 check_close(cyl_bessel_i(-10486074.0/(1024.0*1024), 50), 1.07153277202900671531087024688681954238311679648319534644743e20, eps * 5000, __LINE__);
570 check_close(cyl_bessel_i(144794.0/1024.0, 100), 2066.27694757392660413922181531984160871678224178890247540320, eps * 5000, __LINE__);
571 check_close(cyl_bessel_i(-144794.0/1024.0, 100), 2066.27694672763190927440969155740243346136463461655104698748, eps * 5000, __LINE__);
572
573 check_close(cyl_bessel_j(2457/1024.0, 1/1024.0), 3.80739920118603335646474073457326714709615200130620574875292e-9, eps * 5000, __LINE__);
574 check_close(cyl_bessel_j(5.5, 3217.0/1024), 0.0281933076257506091621579544064767140470089107926550720453038, eps * 5000, __LINE__);
575 check_close(cyl_bessel_j(-5.5, 3217.0/1024), -2.55820064470647911823175836997490971806135336759164272675969, eps * 5000, __LINE__);
576 check_close(cyl_bessel_j(-5.5, 1e+04), 2.449843111985605522111159013846599118397e-03, eps * 5000, __LINE__);
577 check_close(cyl_bessel_j(5.5, 1e+04), 0.00759343502722670361395585198154817047185480147294665270646578, eps * 5000, __LINE__);
578 check_close(cyl_bessel_j(5.5, 1e+06), -0.000747424248595630177396350688505919533097973148718960064663632, eps * 5000, __LINE__);
579 check_close(cyl_bessel_j(5.125, 1e+06), -0.000776600124835704280633640911329691642748783663198207360238214, eps * 5000, __LINE__);
580 check_close(cyl_bessel_j(5.875, 1e+06), -0.000466322721115193071631008581529503095819705088484386434589780, eps * 5000, __LINE__);
581 check_close(cyl_bessel_j(0.5, 101), 0.0358874487875643822020496677692429287863419555699447066226409, eps * 5000, __LINE__);
582 check_close(cyl_bessel_j(-5.5, 1e+04), 0.00244984311198560552211115901384659911839737686676766460822577, eps * 5000, __LINE__);
583 check_close(cyl_bessel_j(-5.5, 1e+06), 0.000279243200433579511095229508894156656558211060453622750659554, eps * 5000, __LINE__);
584 check_close(cyl_bessel_j(-0.5, 101), 0.0708184798097594268482290389188138201440114881159344944791454, eps * 5000, __LINE__);
585 check_close(cyl_bessel_j(-10486074 / (1024*1024.0), 1/1024.0), 1.41474013160494695750009004222225969090304185981836460288562e35, eps * 5000, __LINE__);
586 check_close(cyl_bessel_j(-10486074 / (1024*1024.0), 15), -0.0902239288885423309568944543848111461724911781719692852541489, eps * 5000, __LINE__);
587 check_close(cyl_bessel_j(10486074 / (1024*1024.0), 1e+02), -0.0547064914615137807616774867984047583596945624129838091326863, eps * 5000, __LINE__);
588 check_close(cyl_bessel_j(10486074 / (1024*1024.0), 2e+04), -0.00556783614400875611650958980796060611309029233226596737701688, eps * 5000, __LINE__);
589 check_close(cyl_bessel_j(-10486074 / (1024*1024.0), 1e+02), -0.0547613660316806551338637153942604550779513947674222863858713, eps * 5000, __LINE__);
590
591 check_close(cyl_bessel_k(0.5, 0.875), 0.558532231646608646115729767013630967055657943463362504577189, eps * 5000, __LINE__);
592 check_close(cyl_bessel_k(0.5, 1.125), 0.383621010650189547146769320487006220295290256657827220786527, eps * 5000, __LINE__);
593 check_close(cyl_bessel_k(2.25, ldexp(1.0, -30)), 5.62397392719283271332307799146649700147907612095185712015604e20, eps * 5000, __LINE__);
594 check_close(cyl_bessel_k(5.5, 3217/1024.0), 1.30623288775012596319554857587765179889689223531159532808379, eps * 5000, __LINE__);
595 check_close(cyl_bessel_k(-5.5, 10), 0.0000733045300798502164644836879577484533096239574909573072142667, eps * 5000, __LINE__);
596 check_close(cyl_bessel_k(-5.5, 100), 5.41274555306792267322084448693957747924412508020839543293369e-45, eps * 5000, __LINE__);
597 check_close(cyl_bessel_k(10240/1024.0, 1/1024.0), 2.35522579263922076203415803966825431039900000000993410734978e38, eps * 5000, __LINE__);
598 check_close(cyl_bessel_k(10240/1024.0, 10), 0.00161425530039067002345725193091329085443750382929208307802221, eps * 5000, __LINE__);
599 check_close(cyl_bessel_k(144793/1024.0, 100), 1.39565245860302528069481472855619216759142225046370312329416e-6, eps * 5000, __LINE__);
600 check_close(cyl_bessel_k(144793/1024.0, 200), 9.11950412043225432171915100042647230802198254567007382956336e-68, eps * 5000, __LINE__);
601
602 check_close(cyl_neumann(0.5, 1 / (1024.0*1024)), -817.033790261762580469303126467917092806755460418223776544122, eps * 5000, __LINE__);
603 check_close(cyl_neumann(5.5, 3.125), -2.61489440328417468776474188539366752698192046890955453259866, eps * 5000, __LINE__);
604 check_close(cyl_neumann(-5.5, 3.125), -0.0274994493896489729948109971802244976377957234563871795364056, eps * 5000, __LINE__);
605 check_close(cyl_neumann(-5.5, 1e+04), -0.00759343502722670361395585198154817047185480147294665270646578, eps * 5000, __LINE__);
606 check_close(cyl_neumann(-10486074 / (1024*1024.0), 1/1024.0), -1.50382374389531766117868938966858995093408410498915220070230e38, eps * 5000, __LINE__);
607 check_close(cyl_neumann(-10486074 / (1024*1024.0), 1e+02), 0.0583041891319026009955779707640455341990844522293730214223545, eps * 5000, __LINE__);
608 check_close(cyl_neumann(141.75, 1e+02), -5.38829231428696507293191118661269920130838607482708483122068e9, eps * 5000, __LINE__);
609 check_close(cyl_neumann(141.75, 2e+04), -0.00376577888677186194728129112270988602876597726657372330194186, eps * 5000, __LINE__);
610 check_close(cyl_neumann(-141.75, 1e+02), -3.81009803444766877495905954105669819951653361036342457919021e9, eps * 5000, __LINE__);
611
612 check_close(ellint_1(0, 0), 0, eps * 5000, __LINE__);
613 check_close(ellint_1(0, -10), -10, eps * 5000, __LINE__);
614 check_close(ellint_1(-1, -1), -1.2261911708835170708130609674719067527242483502207, eps * 5000, __LINE__);
615 check_close(ellint_1(0.875, -4), -5.3190556182262405182189463092940736859067548232647, eps * 5000, __LINE__);
616 check_close(ellint_1(-0.625, 8), 9.0419973860310100524448893214394562615252527557062, eps * 5000, __LINE__);
617 check_close(ellint_1(0.875, 1e-05), 0.000010000000000127604166668510945638036143355898993088, eps * 5000, __LINE__);
618 check_close(ellint_1(10/1024.0, 1e+05), 100002.38431454899771096037307519328741455615271038, eps * 5000, __LINE__);
619 check_close(ellint_1(1, 1e-20), 1.0000000000000000000000000000000000000000166666667e-20, eps * 5000, __LINE__);
620 check_close(ellint_1(1e-20, 1e-20), 1.000000000000000e-20, eps * 5000, __LINE__);
621 check_close(ellint_1(400/1024.0, 1e+20), 1.0418143796499216839719289963154558027005142709763e20, eps * 5000, __LINE__);
622 check_close(ellint_1(0.5, 2), 2.1765877052210673672479877957388515321497888026770, eps * 5000, __LINE__);
623 check_close(ellint_1(0.5, 4), 4.2543274975235836861894752787874633017836785640477, eps * 5000, __LINE__);
624 check_close(ellint_1(0.5, 6), 6.4588766202317746302999080620490579800463614807916, eps * 5000, __LINE__);
625 check_close(ellint_1(0.5, 10), 10.697409951222544858346795279378531495869386960090, eps * 5000, __LINE__);
626 check_close(ellint_1(0.5, -2), -2.1765877052210673672479877957388515321497888026770, eps * 5000, __LINE__);
627 check_close(ellint_1(0.5, -4), -4.2543274975235836861894752787874633017836785640477, eps * 5000, __LINE__);
628 check_close(ellint_1(0.5, -6), -6.4588766202317746302999080620490579800463614807916, eps * 5000, __LINE__);
629 check_close(ellint_1(0.5, -10), -10.697409951222544858346795279378531495869386960090, eps * 5000, __LINE__);
630
631 check_close(ellint_2(0, 0), 0, eps * 5000, __LINE__);
632 check_close(ellint_2(0, -10), -10, eps * 5000, __LINE__);
633 check_close(ellint_2(-1, -1), -0.84147098480789650665250232163029899962256306079837, eps * 5000, __LINE__);
634 check_close(ellint_2(900 / 1024.0, -4), -3.1756145986492562317862928524528520686391383168377, eps * 5000, __LINE__);
635 check_close(ellint_2(-600 / 1024.0, 8), 7.2473147180505693037677015377802777959345489333465, eps * 5000, __LINE__);
636 check_close(ellint_2(800 / 1024.0, 1e-05), 9.999999999898274739584436515967055859383969942432E-6, eps * 5000, __LINE__);
637 check_close(ellint_2(100 / 1024.0, 1e+05), 99761.153306972066658135668386691227343323331995888, eps * 5000, __LINE__);
638 check_close(ellint_2(-0.5, 1e+10), 9.3421545766487137036576748555295222252286528414669e9, eps * 5000, __LINE__);
639 check_close(ellint_2(400 / 1024.0, ldexp(1, 66)), 7.0886102721911705466476846969992069994308167515242e19, eps * 5000, __LINE__);
640
641 check_close(ellint_3(0, 1, -1), -1.557407724654902230506974807458360173087, eps * 5000, __LINE__);
642 check_close(ellint_3(0.4, 0, -4), -4.153623371196831087495427530365430979011, eps * 5000, __LINE__);
643 check_close(ellint_3(-0.6, 0, 8), 8.935930619078575123490612395578518914416, eps * 5000, __LINE__);
644 check_close(ellint_3(0.25, 0, 0.5), 0.501246705365439492445236118603525029757890291780157969500480, eps * 5000, __LINE__);
645 check_close(ellint_3(0, 0, 0.5), 0.5, eps * 5000, __LINE__);
646 check_close(ellint_3(0, -2, 0.5), 0.437501067017546278595664813509803743009132067629603474488486, eps * 5000, __LINE__);
647 check_close(ellint_3(0, 0.25, 0.5), 0.510269830229213412212501938035914557628394166585442994564135, eps * 5000, __LINE__);
648 check_close(ellint_3(0, 0.75, 0.5), 0.533293253875952645421201146925578536430596894471541312806165, eps * 5000, __LINE__);
649 check_close(ellint_3(0, 0.75, 0.75), 0.871827580412760575085768367421866079353646112288567703061975, eps * 5000, __LINE__);
650 check_close(ellint_3(0, 1, 0.25), 0.255341921221036266504482236490473678204201638800822621740476, eps * 5000, __LINE__);
651 check_close(ellint_3(0, 2, 0.25), 0.261119051639220165094943572468224137699644963125853641716219, eps * 5000, __LINE__);
652 check_close(ellint_3(0, 1023/1024.0, 1.5), 13.2821612239764190363647953338544569682942329604483733197131, eps * 5000, __LINE__);
653 check_close(ellint_3(0.5, 0.5, -1), -1.228014414316220642611298946293865487807, eps * 5000, __LINE__);
654 check_close(ellint_3(0.5, 0.5, 1e+10), 1.536591003599172091573590441336982730551e+10, eps * 5000, __LINE__);
655 check_close(ellint_3(0.75, -1e+05, 10), 0.0347926099493147087821620459290460547131012904008557007934290, eps * 5000, __LINE__);
656 check_close(ellint_3(0.875, -1e+10, 10), 0.000109956202759561502329123384755016959364346382187364656768212, eps * 5000, __LINE__);
657 check_close(ellint_3(0.875, -1e+10, 1e+20), 1.00000626665567332602765201107198822183913978895904937646809e15, eps * 5000, __LINE__);
658 check_close(ellint_3(0.875, -1e+10, 1608/1024.0), 0.0000157080616044072676127333183571107873332593142625043567690379, eps * 5000, __LINE__);
659 check_close(ellint_3(0.875, 1-1 / 1024.0, 1e+20), 6.43274293944380717581167058274600202023334985100499739678963e21, eps * 5000, __LINE__);
660 check_close(ellint_3(0.25, 50, 0.1), 0.124573770342749525407523258569507331686458866564082916835900, eps * 5000, __LINE__);
661 check_close(ellint_3(0.25, 1.125, 1), 1.77299767784815770192352979665283069318388205110727241629752, eps * 5000, __LINE__);
662
663 check_close(expint(1/1024.0), -6.35327933972759151358547423727042905862963067106751711596065, eps * 5000, __LINE__);
664 check_close(expint(0.125), -1.37320852494298333781545045921206470808223543321810480716122, eps * 5000, __LINE__);
665 check_close(expint(0.5), 0.454219904863173579920523812662802365281405554352642045162818, eps * 5000, __LINE__);
666 check_close(expint(1), 1.89511781635593675546652093433163426901706058173270759164623, eps * 5000, __LINE__);
667 check_close(expint(50.5), 1.72763195602911805201155668940185673806099654090456049881069e20, eps * 5000, __LINE__);
668 check_close(expint(-1/1024.0), -6.35523246483107180261445551935803221293763008553775821607264, eps * 5000, __LINE__);
669 check_close(expint(-0.125), -1.62342564058416879145630692462440887363310605737209536579267, eps * 5000, __LINE__);
670 check_close(expint(-0.5), -0.559773594776160811746795939315085235226846890316353515248293, eps * 5000, __LINE__);
671 check_close(expint(-1), -0.219383934395520273677163775460121649031047293406908207577979, eps * 5000, __LINE__);
672 check_close(expint(-50.5), -2.27237132932219350440719707268817831250090574830769670186618e-24, eps * 5000, __LINE__);
673
674 check_close_fraction(hermite(0, 1), 1.L, 100 * eps, __LINE__);
675 check_close_fraction(hermite(1, 1), 2.L, 100 * eps, __LINE__);
676 check_close_fraction(hermite(1, 2), 4.L, 100 * eps, __LINE__);
677 check_close_fraction(hermite(1, 10), 20, 100 * eps, __LINE__);
678 check_close_fraction(hermite(1, 100), 200, 100 * eps, __LINE__);
679 check_close_fraction(hermite(1, 1e6), 2e6, 100 * eps, __LINE__);
680 check_close_fraction(hermite(10, 30), 5.896624628001300E+17, 100 * eps, __LINE__);
681 check_close_fraction(hermite(10, 1000), 1.023976960161280E+33, 100 * eps, __LINE__);
682 check_close_fraction(hermite(10, 10), 8.093278209760000E+12, 100 * eps, __LINE__);
683 check_close_fraction(hermite(10, -10), 8.093278209760000E+12, 100 * eps, __LINE__);
684 check_close_fraction(hermite(3, -10), -7.880000000000000E+3, 100 * eps, __LINE__);
685 check_close_fraction(hermite(3, -1000), -7.999988000000000E+9, 100 * eps, __LINE__);
686 check_close_fraction(hermite(3, -1000000), -7.999999999988000E+18, 100 * eps, __LINE__);
687
688 check_close(riemann_zeta(0.125), -0.63277562349869525529352526763564627152686379131122, eps * 5000, __LINE__);
689 check_close(riemann_zeta(1023 / 1024.0), -1023.4228554489429786541032870895167448906103303056, eps * 5000, __LINE__);
690 check_close(riemann_zeta(1025 / 1024.0), 1024.5772867695045940578681624248887776501597556226, eps * 5000, __LINE__);
691 check_close(riemann_zeta(0.5), -1.46035450880958681288949915251529801246722933101258149054289, eps * 5000, __LINE__);
692 check_close(riemann_zeta(1.125), 8.5862412945105752999607544082693023591996301183069, eps * 5000, __LINE__);
693 check_close(riemann_zeta(2), 1.6449340668482264364724151666460251892189499012068, eps * 5000, __LINE__);
694 check_close(riemann_zeta(3.5), 1.1267338673170566464278124918549842722219969574036, eps * 5000, __LINE__);
695 check_close(riemann_zeta(4), 1.08232323371113819151600369654116790277475095191872690768298, eps * 5000, __LINE__);
696 check_close(riemann_zeta(4 + 1 / 1024.0), 1.08225596856391369799036835439238249195298434901488518878804, eps * 5000, __LINE__);
697 check_close(riemann_zeta(4.5), 1.05470751076145426402296728896028011727249383295625173068468, eps * 5000, __LINE__);
698 check_close(riemann_zeta(6.5), 1.01200589988852479610078491680478352908773213619144808841031, eps * 5000, __LINE__);
699 check_close(riemann_zeta(7.5), 1.00582672753652280770224164440459408011782510096320822989663, eps * 5000, __LINE__);
700 check_close(riemann_zeta(8.125), 1.0037305205308161603183307711439385250181080293472, eps * 5000, __LINE__);
701 check_close(riemann_zeta(16.125), 1.0000140128224754088474783648500235958510030511915, eps * 5000, __LINE__);
702 check_close(riemann_zeta(0), -0.5, eps * 5000, __LINE__);
703 check_close(riemann_zeta(-0.125), -0.39906966894504503550986928301421235400280637468895, eps * 5000, __LINE__);
704 check_close(riemann_zeta(-1), -0.083333333333333333333333333333333333333333333333333, eps * 5000, __LINE__);
705 check_close(riemann_zeta(-2), 0, eps * 5000, __LINE__);
706 check_close(riemann_zeta(-2.5), 0.0085169287778503305423585670283444869362759902200745, eps * 5000 * 3, __LINE__);
707 check_close(riemann_zeta(-3), 0.0083333333333333333333333333333333333333333333333333, eps * 5000, __LINE__);
708 check_close(riemann_zeta(-4), 0, eps * 5000, __LINE__);
709 check_close(riemann_zeta(-20), 0, eps * 5000 * 100, __LINE__);
710 check_close(riemann_zeta(-21), -281.46014492753623188405797101449275362318840579710, eps * 5000 * 100, __LINE__);
711 check_close(riemann_zeta(-30.125), 2.2762941726834511267740045451463455513839970804578e7, eps * 5000 * 100, __LINE__);
712
713 check_close(sph_bessel(0, 0.1433600485324859619140625e-1), 0.9999657468461303487880990241993035937654e0, eps * 5000 * 100, __LINE__);
714 check_close(sph_bessel(0, 0.1760916970670223236083984375e-1), 0.9999483203249623334100130061926184665364e0, eps * 5000 * 100, __LINE__);
715 check_close(sph_bessel(2, 0.1433600485324859619140625e-1), 0.1370120120703995134662099191103188366059e-4, eps * 5000 * 100, __LINE__);
716 check_close(sph_bessel(2, 0.1760916970670223236083984375e-1), 0.2067173265753174063228459655801741280461e-4, eps * 5000 * 100, __LINE__);
717 check_close(sph_bessel(7, 0.1252804412841796875e3), 0.7887555711993028736906736576314283291289e-2, eps * 5000 * 100, __LINE__);
718 check_close(sph_bessel(7, 0.25554705810546875e3), -0.1463292767579579943284849187188066532514e-2, eps * 5000 * 100, __LINE__);
719
720 check_close(sph_neumann(0, 0.408089816570281982421875e0), -0.2249212131304610409189209411089291558038e1, eps * 5000 * 100, __LINE__);
721 check_close(sph_neumann(0, 0.6540834903717041015625e0), -0.1213309779166084571756446746977955970241e1, eps * 5000 * 100, __LINE__);
722 check_close(sph_neumann(2, 0.408089816570281982421875e0), -0.4541702641837159203058389758895634766256e2, eps * 5000 * 100, __LINE__);
723 check_close(sph_neumann(2, 0.6540834903717041015625e0), -0.1156112621471167110574129561700037138981e2, eps * 5000 * 100, __LINE__);
724 check_close(sph_neumann(10, 0.1097540378570556640625e1), -0.2427889658115064857278886600528596240123e9, eps * 5000 * 100, __LINE__);
725 check_close(sph_neumann(10, 0.30944411754608154296875e1), -0.3394649246350136450439882104151313759251e4, eps * 5000 * 100, __LINE__);
726
727 check_close_fraction(sph_legendre(3, 2, 0.5), 0.2061460599687871330692286791802688341213, eps * 5000, __LINE__);
728 check_close_fraction(sph_legendre(40, 15, 0.75), -0.406036847302819452666908966769096223205057182668333862900509, eps * 5000, __LINE__);
729 #endif
730 }
731
test_valuesl(const char * name)732 void test_valuesl(const char* name)
733 {
734 #ifdef TEST_LD
735 #ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
736 //
737 // First the C99 math functions:
738 //
739 long double eps = LDBL_EPSILON;
740 long double sv;
741 check_close_l(acoshl(coshl(0.5L)), 0.5L, 5000 * eps, __LINE__);
742 check_close_l(asinhl(sinhl(0.5L)), 0.5L, 5000 * eps, __LINE__);
743 check_close_l(atanhl(tanhl(0.5L)), 0.5L, 5000 * eps, __LINE__);
744
745 check_close_l(cbrtl(1.5L * 1.5L * 1.5L), 1.5L, 5000 * eps, __LINE__);
746
747 check(copysignl(1.0L, 1.0L) == 1.0L, __LINE__);
748 check(copysignl(1.0L, -1.0L) == -1.0L, __LINE__);
749 check(copysignl(-1.0L, 1.0L) == 1.0L, __LINE__);
750 check(copysignl(-1.0L, -1.0L) == -1.0L, __LINE__);
751
752 check_close_l(erfcl(0.125), 0.85968379519866618260697055347837660181302041685015L, eps * 1000, __LINE__);
753 check_close_l(erfcl(0.5), 0.47950012218695346231725334610803547126354842424204L, eps * 1000, __LINE__);
754 check_close_l(erfcl(1), 0.15729920705028513065877936491739074070393300203370L, eps * 1000, __LINE__);
755 check_close_l(erfcl(5), 1.5374597944280348501883434853833788901180503147234e-12L, eps * 1000, __LINE__);
756 check_close_l(erfcl(-0.125), 1.1403162048013338173930294465216233981869795831498L, eps * 1000, __LINE__);
757 check_close_l(erfcl(-0.5), 1.5204998778130465376827466538919645287364515757580L, eps * 1000, __LINE__);
758 check_close_l(erfcl(0), 1, eps * 1000, __LINE__);
759
760 check_close_l(erfl(0.125), 0.14031620480133381739302944652162339818697958314985L, eps * 1000, __LINE__);
761 check_close_l(erfl(0.5), 0.52049987781304653768274665389196452873645157575796L, eps * 1000, __LINE__);
762 check_close_l(erfl(1), 0.84270079294971486934122063508260925929606699796630L, eps * 1000, __LINE__);
763 check_close_l(erfl(5), 0.9999999999984625402055719651498116565146166211099L, eps * 1000, __LINE__);
764 check_close_l(erfl(-0.125), -0.14031620480133381739302944652162339818697958314985L, eps * 1000, __LINE__);
765 check_close_l(erfl(-0.5), -0.52049987781304653768274665389196452873645157575796L, eps * 1000, __LINE__);
766 check_close_l(erfl(0), 0, eps * 1000, __LINE__);
767
768 check_close_l(log1pl(0.582029759883880615234375e0), 0.4587086807259736626531803258754840111707e0L, eps * 1000, __LINE__);
769 check_close_l(expm1l(0.582029759883880615234375e0), 0.7896673415707786528734865994546559029663e0L, eps * 1000, __LINE__);
770 check_close_l(log1pl(-0.2047410048544406890869140625e-1), -0.2068660038044094868521052319477265955827e-1L, eps * 1000, __LINE__);
771 check_close_l(expm1l(-0.2047410048544406890869140625e-1), -0.2026592921724753704129022027337835687888e-1L, eps * 1000, __LINE__);
772
773 check_close_l(fmaxl(0.1L, -0.1L), 0.1L, 0, __LINE__);
774 check_close_l(fminl(0.1L, -0.1L), -0.1L, 0, __LINE__);
775
776 check_close_l(hypotl(1.0L, 3.0L), sqrtl(10.0L), eps * 500, __LINE__);
777
778 check_close_l(lgammal(3.5), 1.2009736023470742248160218814507129957702389154682L, 5000 * eps, __LINE__);
779 check_close_l(lgammal(0.125), 2.0194183575537963453202905211670995899482809521344L, 5000 * eps, __LINE__);
780 check_close_l(lgammal(-0.125), 2.1653002489051702517540619481440174064962195287626L, 5000 * eps, __LINE__);
781 check_close_l(lgammal(-3.125), 0.1543111276840418242676072830970532952413339012367L, 5000 * eps, __LINE__);
782 check_close_l(lgammal(-53249.0/1024), -149.43323093420259741100038126078721302600128285894L, 5000 * eps, __LINE__);
783
784 check_close_l(tgammal(3.5), 3.3233509704478425511840640312646472177454052302295L, 5000 * eps, __LINE__);
785 check_close_l(tgammal(0.125), 7.5339415987976119046992298412151336246104195881491L, 5000 * eps, __LINE__);
786 check_close_l(tgammal(-0.125), -8.7172188593831756100190140408231437691829605421405L, 5000 * eps, __LINE__);
787 check_close_l(tgammal(-3.125), 1.1668538708507675587790157356605097019141636072094L, 5000 * eps, __LINE__);
788
789 #ifdef BOOST_HAS_LONG_LONG
790 check(llroundl(2.5L) == 3LL, __LINE__);
791 check(llroundl(2.25L) == 2LL, __LINE__);
792 #endif
793 check(lroundl(2.5L) == 3.0L, __LINE__);
794 check(lroundl(2.25L) == 2.0L, __LINE__);
795 check(roundl(2.5L) == 3.0L, __LINE__);
796 check(roundl(2.25L) == 2.0L, __LINE__);
797
798 check(nextafterl(1.0L, 2.0L) > 1.0L, __LINE__);
799 check(nextafterl(1.0L, -2.0L) < 1.0L, __LINE__);
800 check(nextafterl(nextafterl(1.0L, 2.0L), -2.0L) == 1.0L, __LINE__);
801 check(nextafterl(nextafterl(1.0L, -2.0L), 2.0L) == 1.0L, __LINE__);
802 check(nextafterl(1.0L, 2.0L) > 1.0L, __LINE__);
803 check(nextafterl(1.0L, -2.0L) < 1.0L, __LINE__);
804 check(nextafterl(nextafterl(1.0L, 2.0L), -2.0L) == 1.0L, __LINE__);
805 check(nextafterl(nextafterl(1.0L, -2.0L), 2.0L) == 1.0L, __LINE__);
806
807 check(truncl(2.5L) == 2.0L, __LINE__);
808 check(truncl(2.25L) == 2.0L, __LINE__);
809
810 //
811 // Now for the TR1 math functions:
812 //
813 check_close_fraction_l(assoc_laguerrel(4, 5, 0.5L), 88.31510416666666666666666666666666666667L, eps * 100, __LINE__);
814 check_close_fraction_l(assoc_laguerrel(10, 0, 2.5L), -0.8802526766660982969576719576719576719577L, eps * 100, __LINE__);
815 check_close_fraction_l(assoc_laguerrel(10, 1, 4.5L), 1.564311458042689732142857142857142857143L, eps * 100, __LINE__);
816 check_close_fraction_l(assoc_laguerrel(10, 6, 8.5L), 20.51596541066649098875661375661375661376L, eps * 100, __LINE__);
817 check_close_fraction_l(assoc_laguerrel(10, 12, 12.5L), -199.5560968456234671241181657848324514991L, eps * 100, __LINE__);
818 check_close_fraction_l(assoc_laguerrel(50, 40, 12.5L), -4.996769495006119488583146995907246595400e16L, eps * 100, __LINE__);
819
820 check_close_fraction_l(laguerrel(1, 0.5L), 0.5L, eps * 100, __LINE__);
821 check_close_fraction_l(laguerrel(4, 0.5L), -0.3307291666666666666666666666666666666667L, eps * 100, __LINE__);
822 check_close_fraction_l(laguerrel(7, 0.5L), -0.5183392237103174603174603174603174603175L, eps * 100, __LINE__);
823 check_close_fraction_l(laguerrel(20, 0.5L), 0.3120174870800154148915399248893113634676L, eps * 100, __LINE__);
824 check_close_fraction_l(laguerrel(50, 0.5L), -0.3181388060269979064951118308575628226834L, eps * 100, __LINE__);
825
826 check_close_fraction_l(laguerrel(1, -0.5L), 1.5L, eps * 100, __LINE__);
827 check_close_fraction_l(laguerrel(4, -0.5L), 3.835937500000000000000000000000000000000L, eps * 100, __LINE__);
828 check_close_fraction_l(laguerrel(7, -0.5L), 7.950934709821428571428571428571428571429L, eps * 100, __LINE__);
829 check_close_fraction_l(laguerrel(20, -0.5L), 76.12915699869631476833699787070874048223L, eps * 100, __LINE__);
830 check_close_fraction_l(laguerrel(50, -0.5L), 2307.428631277506570629232863491518399720L, eps * 100, __LINE__);
831
832 check_close_fraction_l(laguerrel(1, 4.5L), -3.500000000000000000000000000000000000000L, eps * 100, __LINE__);
833 check_close_fraction_l(laguerrel(4, 4.5L), 0.08593750000000000000000000000000000000000L, eps * 100, __LINE__);
834 check_close_fraction_l(laguerrel(7, 4.5L), -1.036928013392857142857142857142857142857L, eps * 100, __LINE__);
835 check_close_fraction_l(laguerrel(20, 4.5L), 1.437239150257817378525582974722170737587L, eps * 100, __LINE__);
836 check_close_fraction_l(laguerrel(50, 4.5L), -0.7795068145562651416494321484050019245248L, eps * 100, __LINE__);
837
838 check_close_fraction_l(assoc_legendrel(4, 2, 0.5L), 4.218750000000000000000000000000000000000L, eps * 100, __LINE__);
839 check_close_fraction_l(assoc_legendrel(7, 5, 0.5L), 5696.789530152175143607977274672800795328L, eps * 100, __LINE__);
840 check_close_fraction_l(assoc_legendrel(4, 2, -0.5L), 4.218750000000000000000000000000000000000L, eps * 100, __LINE__);
841 check_close_fraction_l(assoc_legendrel(7, 5, -0.5L), 5696.789530152175143607977274672800795328L, eps * 100, __LINE__);
842
843 check_close_fraction_l(legendrel(1, 0.5L), 0.5L, eps * 100, __LINE__);
844 check_close_fraction_l(legendrel(4, 0.5L), -0.2890625000000000000000000000000000000000L, eps * 100, __LINE__);
845 check_close_fraction_l(legendrel(7, 0.5L), 0.2231445312500000000000000000000000000000L, eps * 100, __LINE__);
846 check_close_fraction_l(legendrel(40, 0.5L), -0.09542943523261546936538467572384923220258L, eps * 100, __LINE__);
847
848 sv = eps / 1024;
849 check_close_l(betal(1, 1), 1, eps * 20 * 100, __LINE__);
850 check_close_l(betal(1, 4), 0.25, eps * 20 * 100, __LINE__);
851 check_close_l(betal(4, 1), 0.25, eps * 20 * 100, __LINE__);
852 check_close_l(betal(sv, 4), 1/sv, eps * 20 * 100, __LINE__);
853 check_close_l(betal(4, sv), 1/sv, eps * 20 * 100, __LINE__);
854 check_close_l(betal(4, 20), 0.00002823263692828910220214568040654997176736L, eps * 20 * 100, __LINE__);
855 check_close_l(betal(0.0125L, 0.000023L), 43558.24045647538375006349016083320744662L, eps * 20 * 100, __LINE__);
856
857 check_close_l(comp_ellint_1l(0), 1.5707963267948966192313216916397514420985846996876L, eps * 5000, __LINE__);
858 check_close_l(comp_ellint_1l(0.125), 1.5769867712158131421244030532288080803822271060839L, eps * 5000, __LINE__);
859 check_close_l(comp_ellint_1l(0.25), 1.5962422221317835101489690714979498795055744578951L, eps * 5000, __LINE__);
860 check_close_l(comp_ellint_1l(300/1024.0L), 1.6062331054696636704261124078746600894998873503208L, eps * 5000, __LINE__);
861 check_close_l(comp_ellint_1l(400/1024.0L), 1.6364782007562008756208066125715722889067992997614L, eps * 5000, __LINE__);
862 check_close_l(comp_ellint_1l(-0.5), 1.6857503548125960428712036577990769895008008941411L, eps * 5000, __LINE__);
863 check_close_l(comp_ellint_1l(-0.75), 1.9109897807518291965531482187613425592531451316788L, eps * 5000, __LINE__);
864
865 check_close_l(comp_ellint_2l(-1), 1.0L, eps * 5000, __LINE__);
866 check_close_l(comp_ellint_2l(0), 1.5707963267948966192313216916397514420985846996876L, eps * 5000, __LINE__);
867 check_close_l(comp_ellint_2l(100 / 1024.0L), 1.5670445330545086723323795143598956428788609133377L, eps * 5000, __LINE__);
868 check_close_l(comp_ellint_2l(200 / 1024.0L), 1.5557071588766556854463404816624361127847775545087L, eps * 5000, __LINE__);
869 check_close_l(comp_ellint_2l(300 / 1024.0L), 1.5365278991162754883035625322482669608948678755743L, eps * 5000, __LINE__);
870 check_close_l(comp_ellint_2l(400 / 1024.0L), 1.5090417763083482272165682786143770446401437564021L, eps * 5000, __LINE__);
871 check_close_l(comp_ellint_2l(-0.5), 1.4674622093394271554597952669909161360253617523272L, eps * 5000, __LINE__);
872 check_close_l(comp_ellint_2l(-600 / 1024.0L), 1.4257538571071297192428217218834579920545946473778L, eps * 5000, __LINE__);
873 check_close_l(comp_ellint_2l(-800 / 1024.0L), 1.2927868476159125056958680222998765985004489572909L, eps * 5000, __LINE__);
874 check_close_l(comp_ellint_2l(-900 / 1024.0L), 1.1966864890248739524112920627353824133420353430982L, eps * 5000, __LINE__);
875
876 check_close_l(comp_ellint_3l(0.2L, 0), 1.586867847454166237308008033828114192951L, eps * 5000, __LINE__);
877 check_close_l(comp_ellint_3l(0.4L, 0), 1.639999865864511206865258329748601457626L, eps * 5000, __LINE__);
878 check_close_l(comp_ellint_3l(0.0L, 0), 1.57079632679489661923132169163975144209858469968755291048747L, eps * 5000, __LINE__);
879 check_close_l(comp_ellint_3l(0.0L, 0.5), 2.221441469079183123507940495030346849307L, eps * 5000, __LINE__);
880 check_close_l(comp_ellint_3l(0.3L, -4), 0.712708870925620061597924858162260293305195624270730660081949L, eps * 5000, __LINE__);
881 check_close_l(comp_ellint_3l(-0.5L, -1e+05), 0.00496944596485066055800109163256108604615568144080386919012831L, eps * 5000, __LINE__);
882 check_close_l(comp_ellint_3l(-0.75L, -1e+10), 0.0000157080225184890546939710019277357161497407143903832703317801L, eps * 5000, __LINE__);
883 check_close_l(comp_ellint_3l(-0.875L, 1 / 1024.0L), 2.18674503176462374414944618968850352696579451638002110619287L, eps * 5000, __LINE__);
884 check_close_l(comp_ellint_3l(-0.875L, 1023/1024.0L), 101.045289804941384100960063898569538919135722087486350366997L, eps * 5000, __LINE__);
885
886 check_close_l(cyl_bessel_il(2.25L, 1/(1024.0L*1024.0L)), 2.34379212133481347189068464680335815256364262507955635911656e-15L, eps * 5000, __LINE__);
887 check_close_l(cyl_bessel_il(5.5L, 3.125), 0.0583514045989371500460946536220735787163510569634133670181210L, eps * 5000, __LINE__);
888 check_close_l(cyl_bessel_il(-5 + 1.0L/1024.0L, 2.125), 0.0267920938009571023702933210070984416052633027166975342895062L, eps * 5000, __LINE__);
889 check_close_l(cyl_bessel_il(-5.5L, 10), 597.577606961369169607937419869926705730305175364662688426534L, eps * 5000, __LINE__);
890 check_close_l(cyl_bessel_il(-10486074.0L/(1024.0L*1024), 1/1024.0L), 1.41474005665181350367684623930576333542989766867888186478185e35L, eps * 5000, __LINE__);
891 check_close_l(cyl_bessel_il(-10486074.0L/(1024.0L*1024), 50), 1.07153277202900671531087024688681954238311679648319534644743e20L, eps * 5000, __LINE__);
892 check_close_l(cyl_bessel_il(144794.0L/1024.0L, 100), 2066.27694757392660413922181531984160871678224178890247540320L, eps * 5000, __LINE__);
893 check_close_l(cyl_bessel_il(-144794.0L/1024.0L, 100), 2066.27694672763190927440969155740243346136463461655104698748L, eps * 5000, __LINE__);
894
895 check_close_l(cyl_bessel_jl(2457/1024.0L, 1/1024.0L), 3.80739920118603335646474073457326714709615200130620574875292e-9L, eps * 5000, __LINE__);
896 check_close_l(cyl_bessel_jl(5.5L, 3217.0L/1024), 0.0281933076257506091621579544064767140470089107926550720453038L, eps * 5000, __LINE__);
897 check_close_l(cyl_bessel_jl(-5.5L, 3217.0L/1024), -2.55820064470647911823175836997490971806135336759164272675969L, eps * 5000, __LINE__);
898 check_close_l(cyl_bessel_jl(-5.5L, 1e+04L), 2.449843111985605522111159013846599118397e-03L, eps * 50000, __LINE__);
899 check_close_l(cyl_bessel_jl(5.5L, 1e+04L), 0.00759343502722670361395585198154817047185480147294665270646578L, eps * 5000, __LINE__);
900 //check_close_l(cyl_bessel_jl(5.5L, 1e+06), -0.000747424248595630177396350688505919533097973148718960064663632L, eps * 5000, __LINE__);
901 //check_close_l(cyl_bessel_jl(5.125L, 1e+06), -0.000776600124835704280633640911329691642748783663198207360238214L, eps * 5000, __LINE__);
902 //check_close_l(cyl_bessel_jl(5.875L, 1e+06), -0.000466322721115193071631008581529503095819705088484386434589780L, eps * 5000, __LINE__);
903 check_close_l(cyl_bessel_jl(0.5L, 101), 0.0358874487875643822020496677692429287863419555699447066226409L, eps * 5000, __LINE__);
904 check_close_l(cyl_bessel_jl(-5.5L, 1e+04L), 0.00244984311198560552211115901384659911839737686676766460822577L, eps * 50000, __LINE__);
905 //check_close_l(cyl_bessel_jl(-5.5L, 1e+06), 0.000279243200433579511095229508894156656558211060453622750659554L, eps * 5000, __LINE__);
906 check_close_l(cyl_bessel_jl(-0.5L, 101), 0.0708184798097594268482290389188138201440114881159344944791454L, eps * 5000, __LINE__);
907 check_close_l(cyl_bessel_jl(-10486074 / (1024*1024.0L), 1/1024.0L), 1.41474013160494695750009004222225969090304185981836460288562e35L, eps * 5000, __LINE__);
908 check_close_l(cyl_bessel_jl(-10486074 / (1024*1024.0L), 15), -0.0902239288885423309568944543848111461724911781719692852541489L, eps * 5000, __LINE__);
909 check_close_l(cyl_bessel_jl(10486074 / (1024*1024.0L), 1e+02L), -0.0547064914615137807616774867984047583596945624129838091326863L, eps * 5000, __LINE__);
910 check_close_l(cyl_bessel_jl(10486074 / (1024*1024.0L), 2e+04L), -0.00556783614400875611650958980796060611309029233226596737701688L, eps * 5000, __LINE__);
911 check_close_l(cyl_bessel_jl(-10486074 / (1024*1024.0L), 1e+02L), -0.0547613660316806551338637153942604550779513947674222863858713L, eps * 5000, __LINE__);
912
913 check_close_l(cyl_bessel_kl(0.5L, 0.875), 0.558532231646608646115729767013630967055657943463362504577189L, eps * 5000, __LINE__);
914 check_close_l(cyl_bessel_kl(0.5L, 1.125), 0.383621010650189547146769320487006220295290256657827220786527L, eps * 5000, __LINE__);
915 check_close_l(cyl_bessel_kl(2.25L, ldexpl(1.0L, -30)), 5.62397392719283271332307799146649700147907612095185712015604e20L, eps * 5000, __LINE__);
916 check_close_l(cyl_bessel_kl(5.5L, 3217/1024.0L), 1.30623288775012596319554857587765179889689223531159532808379L, eps * 5000, __LINE__);
917 check_close_l(cyl_bessel_kl(-5.5L, 10), 0.0000733045300798502164644836879577484533096239574909573072142667L, eps * 5000, __LINE__);
918 check_close_l(cyl_bessel_kl(-5.5L, 100), 5.41274555306792267322084448693957747924412508020839543293369e-45L, eps * 5000, __LINE__);
919 check_close_l(cyl_bessel_kl(10240/1024.0L, 1/1024.0L), 2.35522579263922076203415803966825431039900000000993410734978e38L, eps * 5000, __LINE__);
920 check_close_l(cyl_bessel_kl(10240/1024.0L, 10), 0.00161425530039067002345725193091329085443750382929208307802221L, eps * 5000, __LINE__);
921 check_close_l(cyl_bessel_kl(144793/1024.0L, 100), 1.39565245860302528069481472855619216759142225046370312329416e-6L, eps * 5000, __LINE__);
922 check_close_l(cyl_bessel_kl(144793/1024.0L, 200), 9.11950412043225432171915100042647230802198254567007382956336e-68L, eps * 5000, __LINE__);
923
924 check_close_l(cyl_neumannl(0.5L, 1 / (1024.0L*1024)), -817.033790261762580469303126467917092806755460418223776544122L, eps * 5000, __LINE__);
925 check_close_l(cyl_neumannl(5.5L, 3.125), -2.61489440328417468776474188539366752698192046890955453259866L, eps * 5000, __LINE__);
926 check_close_l(cyl_neumannl(-5.5L, 3.125), -0.0274994493896489729948109971802244976377957234563871795364056L, eps * 5000, __LINE__);
927 check_close_l(cyl_neumannl(-5.5L, 1e+04), -0.00759343502722670361395585198154817047185480147294665270646578L, eps * 5000, __LINE__);
928 check_close_l(cyl_neumannl(-10486074 / (1024*1024.0L), 1/1024.0L), -1.50382374389531766117868938966858995093408410498915220070230e38L, eps * 5000, __LINE__);
929 check_close_l(cyl_neumannl(-10486074 / (1024*1024.0L), 1e+02L), 0.0583041891319026009955779707640455341990844522293730214223545L, eps * 5000, __LINE__);
930 check_close_l(cyl_neumannl(141.75L, 1e+02), -5.38829231428696507293191118661269920130838607482708483122068e9L, eps * 5000, __LINE__);
931 check_close_l(cyl_neumannl(141.75L, 2e+04), -0.00376577888677186194728129112270988602876597726657372330194186L, eps * 50000, __LINE__);
932 check_close_l(cyl_neumannl(-141.75L, 1e+02), -3.81009803444766877495905954105669819951653361036342457919021e9L, eps * 5000, __LINE__);
933
934 check_close_l(ellint_1l(0, 0), 0, eps * 5000, __LINE__);
935 check_close_l(ellint_1l(0, -10), -10, eps * 5000, __LINE__);
936 check_close_l(ellint_1l(-1, -1), -1.2261911708835170708130609674719067527242483502207L, eps * 5000, __LINE__);
937 check_close_l(ellint_1l(0.875L, -4), -5.3190556182262405182189463092940736859067548232647L, eps * 5000, __LINE__);
938 check_close_l(ellint_1l(-0.625L, 8), 9.0419973860310100524448893214394562615252527557062L, eps * 5000, __LINE__);
939 check_close_l(ellint_1l(0.875L, 1e-05L), 0.000010000000000127604166668510945638036143355898993088L, eps * 5000, __LINE__);
940 check_close_l(ellint_1l(10/1024.0L, 1e+05L), 100002.38431454899771096037307519328741455615271038L, eps * 5000, __LINE__);
941 check_close_l(ellint_1l(1, 1e-20L), 1.0000000000000000000000000000000000000000166666667e-20L, eps * 5000, __LINE__);
942 check_close_l(ellint_1l(1e-20L, 1e-20L), 1.000000000000000e-20L, eps * 5000, __LINE__);
943 check_close_l(ellint_1l(400/1024.0L, 1e+20L), 1.0418143796499216839719289963154558027005142709763e20L, eps * 5000, __LINE__);
944 check_close_l(ellint_1l(0.5L, 2), 2.1765877052210673672479877957388515321497888026770L, eps * 5000, __LINE__);
945 check_close_l(ellint_1l(0.5L, 4), 4.2543274975235836861894752787874633017836785640477L, eps * 5000, __LINE__);
946 check_close_l(ellint_1l(0.5L, 6), 6.4588766202317746302999080620490579800463614807916L, eps * 5000, __LINE__);
947 check_close_l(ellint_1l(0.5L, 10), 10.697409951222544858346795279378531495869386960090L, eps * 5000, __LINE__);
948 check_close_l(ellint_1l(0.5L, -2), -2.1765877052210673672479877957388515321497888026770L, eps * 5000, __LINE__);
949 check_close_l(ellint_1l(0.5L, -4), -4.2543274975235836861894752787874633017836785640477L, eps * 5000, __LINE__);
950 check_close_l(ellint_1l(0.5L, -6), -6.4588766202317746302999080620490579800463614807916L, eps * 5000, __LINE__);
951 check_close_l(ellint_1l(0.5L, -10), -10.697409951222544858346795279378531495869386960090L, eps * 5000, __LINE__);
952
953 check_close_l(ellint_2l(0, 0), 0, eps * 5000, __LINE__);
954 check_close_l(ellint_2l(0, -10), -10, eps * 5000, __LINE__);
955 check_close_l(ellint_2l(-1, -1), -0.84147098480789650665250232163029899962256306079837L, eps * 5000, __LINE__);
956 check_close_l(ellint_2l(900 / 1024.0L, -4), -3.1756145986492562317862928524528520686391383168377L, eps * 5000, __LINE__);
957 check_close_l(ellint_2l(-600 / 1024.0L, 8), 7.2473147180505693037677015377802777959345489333465L, eps * 5000, __LINE__);
958 check_close_l(ellint_2l(800 / 1024.0L, 1e-05L), 9.999999999898274739584436515967055859383969942432E-6L, eps * 5000, __LINE__);
959 check_close_l(ellint_2l(100 / 1024.0L, 1e+05L), 99761.153306972066658135668386691227343323331995888L, eps * 5000, __LINE__);
960 check_close_l(ellint_2l(-0.5L, 1e+10L), 9.3421545766487137036576748555295222252286528414669e9L, eps * 5000, __LINE__);
961 check_close_l(ellint_2l(400 / 1024.0L, ldexpl(1, 66)), 7.0886102721911705466476846969992069994308167515242e19L, eps * 5000, __LINE__);
962
963 check_close_l(ellint_3l(0, 1, -1), -1.557407724654902230506974807458360173087L, eps * 5000, __LINE__);
964 check_close_l(ellint_3l(0.4L, 0, -4), -4.153623371196831087495427530365430979011L, eps * 5000, __LINE__);
965 check_close_l(ellint_3l(-0.6L, 0, 8), 8.935930619078575123490612395578518914416L, eps * 5000, __LINE__);
966 check_close_l(ellint_3l(0.25L, 0, 0.5L), 0.501246705365439492445236118603525029757890291780157969500480L, eps * 5000, __LINE__);
967 check_close_l(ellint_3l(0, 0, 0.5L), 0.5L, eps * 5000, __LINE__);
968 check_close_l(ellint_3l(0, -2, 0.5L), 0.437501067017546278595664813509803743009132067629603474488486L, eps * 5000, __LINE__);
969 check_close_l(ellint_3l(0, 0.25L, 0.5L), 0.510269830229213412212501938035914557628394166585442994564135L, eps * 5000, __LINE__);
970 check_close_l(ellint_3l(0, 0.75L, 0.5L), 0.533293253875952645421201146925578536430596894471541312806165L, eps * 5000, __LINE__);
971 check_close_l(ellint_3l(0, 0.75L, 0.75), 0.871827580412760575085768367421866079353646112288567703061975L, eps * 5000, __LINE__);
972 check_close_l(ellint_3l(0, 1, 0.25L), 0.255341921221036266504482236490473678204201638800822621740476L, eps * 5000, __LINE__);
973 check_close_l(ellint_3l(0, 2, 0.25L), 0.261119051639220165094943572468224137699644963125853641716219L, eps * 5000, __LINE__);
974 check_close_l(ellint_3l(0, 1023/1024.0L, 1.5), 13.2821612239764190363647953338544569682942329604483733197131L, eps * 5000, __LINE__);
975 check_close_l(ellint_3l(0.5L, 0.5L, -1), -1.228014414316220642611298946293865487807L, eps * 5000, __LINE__);
976 check_close_l(ellint_3l(0.5L, 0.5L, 1e+10L), 1.536591003599172091573590441336982730551e+10L, eps * 5000, __LINE__);
977 check_close_l(ellint_3l(0.75L, -1e+05L, 10), 0.0347926099493147087821620459290460547131012904008557007934290L, eps * 5000, __LINE__);
978 check_close_l(ellint_3l(0.875L, -1e+10L, 10), 0.000109956202759561502329123384755016959364346382187364656768212L, eps * 5000, __LINE__);
979 check_close_l(ellint_3l(0.875L, -1e+10L, 1e+20L), 1.00000626665567332602765201107198822183913978895904937646809e15L, eps * 5000, __LINE__);
980 check_close_l(ellint_3l(0.875L, -1e+10L, 1608/1024.0L), 0.0000157080616044072676127333183571107873332593142625043567690379L, eps * 5000, __LINE__);
981 check_close_l(ellint_3l(0.875L, 1-1 / 1024.0L, 1e+20L), 6.43274293944380717581167058274600202023334985100499739678963e21L, eps * 5000, __LINE__);
982 check_close_l(ellint_3l(0.25L, 50, 0.1L), 0.124573770342749525407523258569507331686458866564082916835900L, eps * 5000, __LINE__);
983 check_close_l(ellint_3l(0.25L, 1.125L, 1), 1.77299767784815770192352979665283069318388205110727241629752L, eps * 5000, __LINE__);
984
985 check_close_l(expintl(1/1024.0L), -6.35327933972759151358547423727042905862963067106751711596065L, eps * 5000, __LINE__);
986 check_close_l(expintl(0.125), -1.37320852494298333781545045921206470808223543321810480716122L, eps * 5000, __LINE__);
987 check_close_l(expintl(0.5), 0.454219904863173579920523812662802365281405554352642045162818L, eps * 5000, __LINE__);
988 check_close_l(expintl(1), 1.89511781635593675546652093433163426901706058173270759164623L, eps * 5000, __LINE__);
989 check_close_l(expintl(50.5), 1.72763195602911805201155668940185673806099654090456049881069e20L, eps * 5000, __LINE__);
990 check_close_l(expintl(-1/1024.0L), -6.35523246483107180261445551935803221293763008553775821607264L, eps * 5000, __LINE__);
991 check_close_l(expintl(-0.125), -1.62342564058416879145630692462440887363310605737209536579267L, eps * 5000, __LINE__);
992 check_close_l(expintl(-0.5), -0.559773594776160811746795939315085235226846890316353515248293L, eps * 5000, __LINE__);
993 check_close_l(expintl(-1), -0.219383934395520273677163775460121649031047293406908207577979L, eps * 5000, __LINE__);
994 check_close_l(expintl(-50.5), -2.27237132932219350440719707268817831250090574830769670186618e-24L, eps * 5000, __LINE__);
995
996 check_close_fraction_l(hermitel(0, 1), 1.L, 100 * eps, __LINE__);
997 check_close_fraction_l(hermitel(1, 1), 2.L, 100 * eps, __LINE__);
998 check_close_fraction_l(hermitel(1, 2), 4.L, 100 * eps, __LINE__);
999 check_close_fraction_l(hermitel(1, 10), 20, 100 * eps, __LINE__);
1000 check_close_fraction_l(hermitel(1, 100), 200, 100 * eps, __LINE__);
1001 check_close_fraction_l(hermitel(1, 1e6), 2e6L, 100 * eps, __LINE__);
1002 //check_close_fraction_l(hermitel(10, 30), 5.896624628001300E+17L, 100 * eps, __LINE__);
1003 //check_close_fraction_l(hermitel(10, 1000), 1.023976960161280E+33L, 100 * eps, __LINE__);
1004 check_close_fraction_l(hermitel(10, 10), 8.093278209760000E+12L, 100 * eps, __LINE__);
1005 check_close_fraction_l(hermitel(10, -10), 8.093278209760000E+12L, 100 * eps, __LINE__);
1006 check_close_fraction_l(hermitel(3, -10), -7.880000000000000E+3L, 100 * eps, __LINE__);
1007 check_close_fraction_l(hermitel(3, -1000), -7.999988000000000E+9L, 100 * eps, __LINE__);
1008 check_close_fraction_l(hermitel(3, -1000000), -7.999999999988000E+18L, 100 * eps, __LINE__);
1009
1010 check_close_l(riemann_zetal(0.125), -0.63277562349869525529352526763564627152686379131122L, eps * 5000, __LINE__);
1011 check_close_l(riemann_zetal(1023 / 1024.0L), -1023.4228554489429786541032870895167448906103303056L, eps * 5000, __LINE__);
1012 check_close_l(riemann_zetal(1025 / 1024.0L), 1024.5772867695045940578681624248887776501597556226L, eps * 5000, __LINE__);
1013 check_close_l(riemann_zetal(0.5L), -1.46035450880958681288949915251529801246722933101258149054289L, eps * 5000, __LINE__);
1014 check_close_l(riemann_zetal(1.125L), 8.5862412945105752999607544082693023591996301183069L, eps * 5000, __LINE__);
1015 check_close_l(riemann_zetal(2), 1.6449340668482264364724151666460251892189499012068L, eps * 5000, __LINE__);
1016 check_close_l(riemann_zetal(3.5L), 1.1267338673170566464278124918549842722219969574036L, eps * 5000, __LINE__);
1017 check_close_l(riemann_zetal(4), 1.08232323371113819151600369654116790277475095191872690768298L, eps * 5000, __LINE__);
1018 check_close_l(riemann_zetal(4 + 1 / 1024.0L), 1.08225596856391369799036835439238249195298434901488518878804L, eps * 5000, __LINE__);
1019 check_close_l(riemann_zetal(4.5L), 1.05470751076145426402296728896028011727249383295625173068468L, eps * 5000, __LINE__);
1020 check_close_l(riemann_zetal(6.5L), 1.01200589988852479610078491680478352908773213619144808841031L, eps * 5000, __LINE__);
1021 check_close_l(riemann_zetal(7.5L), 1.00582672753652280770224164440459408011782510096320822989663L, eps * 5000, __LINE__);
1022 check_close_l(riemann_zetal(8.125L), 1.0037305205308161603183307711439385250181080293472L, eps * 5000, __LINE__);
1023 check_close_l(riemann_zetal(16.125L), 1.0000140128224754088474783648500235958510030511915L, eps * 5000, __LINE__);
1024 check_close_l(riemann_zetal(0), -0.5L, eps * 5000, __LINE__);
1025 check_close_l(riemann_zetal(-0.125L), -0.39906966894504503550986928301421235400280637468895L, eps * 5000, __LINE__);
1026 check_close_l(riemann_zetal(-1), -0.083333333333333333333333333333333333333333333333333L, eps * 5000, __LINE__);
1027 check_close_l(riemann_zetal(-2), 0, eps * 5000, __LINE__);
1028 check_close_l(riemann_zetal(-2.5L), 0.0085169287778503305423585670283444869362759902200745L, eps * 5000 * 3, __LINE__);
1029 check_close_l(riemann_zetal(-3), 0.0083333333333333333333333333333333333333333333333333L, eps * 5000, __LINE__);
1030 check_close_l(riemann_zetal(-4), 0, eps * 5000, __LINE__);
1031 check_close_l(riemann_zetal(-20), 0, eps * 5000 * 100, __LINE__);
1032 check_close_l(riemann_zetal(-21), -281.46014492753623188405797101449275362318840579710L, eps * 5000 * 100, __LINE__);
1033 check_close_l(riemann_zetal(-30.125L), 2.2762941726834511267740045451463455513839970804578e7L, eps * 5000 * 100, __LINE__);
1034
1035 check_close_l(sph_bessell(0, 0.1433600485324859619140625e-1L), 0.9999657468461303487880990241993035937654e0L, eps * 5000 * 100, __LINE__);
1036 check_close_l(sph_bessell(0, 0.1760916970670223236083984375e-1L), 0.9999483203249623334100130061926184665364e0L, eps * 5000 * 100, __LINE__);
1037 check_close_l(sph_bessell(2, 0.1433600485324859619140625e-1L), 0.1370120120703995134662099191103188366059e-4L, eps * 5000 * 100, __LINE__);
1038 check_close_l(sph_bessell(2, 0.1760916970670223236083984375e-1L), 0.2067173265753174063228459655801741280461e-4L, eps * 5000 * 100, __LINE__);
1039 check_close_l(sph_bessell(7, 0.1252804412841796875e3L), 0.7887555711993028736906736576314283291289e-2L, eps * 5000 * 100, __LINE__);
1040 check_close_l(sph_bessell(7, 0.25554705810546875e3L), -0.1463292767579579943284849187188066532514e-2L, eps * 5000 * 100, __LINE__);
1041
1042 check_close_l(sph_neumannl(0, 0.408089816570281982421875e0L), -0.2249212131304610409189209411089291558038e1L, eps * 5000 * 100, __LINE__);
1043 check_close_l(sph_neumannl(0, 0.6540834903717041015625e0L), -0.1213309779166084571756446746977955970241e1L, eps * 5000 * 100, __LINE__);
1044 check_close_l(sph_neumannl(2, 0.408089816570281982421875e0L), -0.4541702641837159203058389758895634766256e2L, eps * 5000 * 100, __LINE__);
1045 check_close_l(sph_neumannl(2, 0.6540834903717041015625e0L), -0.1156112621471167110574129561700037138981e2L, eps * 5000 * 100, __LINE__);
1046 check_close_l(sph_neumannl(10, 0.1097540378570556640625e1L), -0.2427889658115064857278886600528596240123e9L, eps * 5000 * 100, __LINE__);
1047 check_close_l(sph_neumannl(10, 0.30944411754608154296875e1L), -0.3394649246350136450439882104151313759251e4L, eps * 5000 * 100, __LINE__);
1048
1049 check_close_fraction_l(sph_legendrel(3, 2, 0.5L), 0.2061460599687871330692286791802688341213L, eps * 5000, __LINE__);
1050 check_close_fraction_l(sph_legendrel(40, 15, 0.75L), -0.406036847302819452666908966769096223205057182668333862900509L, eps * 5000, __LINE__);
1051 #endif
1052 #endif
1053 }
1054
main(int argc,char * argv[])1055 int main(int argc, char* argv[])
1056 {
1057 #ifndef TEST_LD
1058 test_values_f("float");
1059 test_values("double");
1060 #else
1061 #ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
1062 test_valuesl("long double");
1063 #endif
1064 #endif
1065 return errors;
1066 }
1067