@@ -99,20 +99,23 @@ T cyl_bessel_j_imp(T v, T x, const bessel_no_int_tag& t, const Policy& pol)
99
99
if (x < 0 )
100
100
{
101
101
// better have integer v:
102
- if (floor (v) == v)
102
+ if (floor (v) == v)
103
103
{
104
+ // LCOV_EXCL_START
105
+ // This branch is hit by multiprecision types only, and is
106
+ // tested by our real_concept tests, but thee are excluded from coverage
107
+ // due to time constraints.
104
108
T r = cyl_bessel_j_imp (v, T (-x), t, pol);
105
- if (iround (v, pol) & 1 )
109
+ if (iround (v, pol) & 1 )
106
110
r = -r;
107
111
return r;
112
+ // LCOV_EXCL_STOP
108
113
}
109
114
else
110
- return policies::raise_domain_error<T>(
111
- function,
112
- " Got x = %1%, but we need x >= 0" , x, pol);
115
+ return policies::raise_domain_error<T>(function, " Got x = %1%, but we need x >= 0" , x, pol);
113
116
}
114
117
115
- T result_J, y;
118
+ T result_J, y; // LCOV_EXCL_LINE
116
119
bessel_jy (v, x, &result_J, &y, need_j, pol);
117
120
return result_J;
118
121
}
@@ -143,9 +146,7 @@ inline T sph_bessel_j_imp(unsigned n, T x, const Policy& pol)
143
146
{
144
147
BOOST_MATH_STD_USING // ADL of std names
145
148
if (x < 0 )
146
- return policies::raise_domain_error<T>(
147
- " boost::math::sph_bessel_j<%1%>(%1%,%1%)" ,
148
- " Got x = %1%, but function requires x > 0." , x, pol);
149
+ return policies::raise_domain_error<T>(" boost::math::sph_bessel_j<%1%>(%1%,%1%)" , " Got x = %1%, but function requires x > 0." , x, pol);
149
150
//
150
151
// Special case, n == 0 resolves down to the sinus cardinal of x:
151
152
//
@@ -190,9 +191,7 @@ T cyl_bessel_i_imp(T v, T x, const Policy& pol)
190
191
return r;
191
192
}
192
193
else
193
- return policies::raise_domain_error<T>(
194
- " boost::math::cyl_bessel_i<%1%>(%1%,%1%)" ,
195
- " Got x = %1%, but we need x >= 0" , x, pol);
194
+ return policies::raise_domain_error<T>(" boost::math::cyl_bessel_i<%1%>(%1%,%1%)" , " Got x = %1%, but we need x >= 0" , x, pol);
196
195
}
197
196
if (x == 0 )
198
197
{
@@ -221,7 +220,7 @@ T cyl_bessel_i_imp(T v, T x, const Policy& pol)
221
220
}
222
221
if ((v > 0 ) && (x / v < 0.25 ))
223
222
return bessel_i_small_z_series (v, x, pol);
224
- T result_I, result_K;
223
+ T result_I, result_K; // LCOV_EXCL_LINE
225
224
bessel_ik (v, x, &result_I, &result_K, need_i, pol);
226
225
return result_I;
227
226
}
@@ -240,11 +239,9 @@ inline T cyl_bessel_k_imp(T v, T x, const bessel_no_int_tag& /* t */, const Poli
240
239
if (x == 0 )
241
240
{
242
241
return (v == 0 ) ? policies::raise_overflow_error<T>(function, nullptr , pol)
243
- : policies::raise_domain_error<T>(
244
- function,
245
- " Got x = %1%, but we need x > 0" , x, pol);
242
+ : policies::raise_domain_error<T>(function, " Got x = %1%, but we need x > 0" , x, pol);
246
243
}
247
- T result_I, result_K;
244
+ T result_I, result_K; // LCOV_EXCL_LINE
248
245
bessel_ik (v, x, &result_I, &result_K, need_k, pol);
249
246
return result_K;
250
247
}
@@ -278,19 +275,17 @@ inline T cyl_neumann_imp(T v, T x, const bessel_no_int_tag&, const Policy& pol)
278
275
{
279
276
return (v == 0 ) && (x == 0 ) ?
280
277
policies::raise_overflow_error<T>(function, nullptr , pol)
281
- : policies::raise_domain_error<T>(
282
- function,
283
- " Got x = %1%, but result is complex for x <= 0" , x, pol);
278
+ : policies::raise_domain_error<T>(function, " Got x = %1%, but result is complex for x <= 0" , x, pol);
284
279
}
285
- T result_J, y;
280
+ T result_J, y; // LCOV_EXCL_LINE
286
281
bessel_jy (v, x, &result_J, &y, need_y, pol);
287
282
//
288
283
// Post evaluation check for internal overflow during evaluation,
289
284
// can occur when x is small and v is large, in which case the result
290
285
// is -INF:
291
286
//
292
287
if (!(boost::math::isfinite)(y))
293
- return -policies::raise_overflow_error<T>(function, nullptr , pol);
288
+ return -policies::raise_overflow_error<T>(function, nullptr , pol); // LCOV_EXCL_LINE defensive programming? Might be dead code now...
294
289
return y;
295
290
}
296
291
@@ -329,17 +324,15 @@ inline T sph_neumann_imp(unsigned v, T x, const Policy& pol)
329
324
// evaluate the function's definition directly:
330
325
//
331
326
if (x < 0 )
332
- return policies::raise_domain_error<T>(
333
- function,
334
- " Got x = %1%, but function requires x > 0." , x, pol);
327
+ return policies::raise_domain_error<T>(function, " Got x = %1%, but function requires x > 0." , x, pol);
335
328
336
329
if (x < 2 * tools::min_value<T>())
337
330
return -policies::raise_overflow_error<T>(function, nullptr , pol);
338
331
339
332
T result = cyl_neumann_imp (T (T (v)+0 .5f ), x, bessel_no_int_tag (), pol);
340
333
T tx = sqrt (constants::pi <T>() / (2 * x));
341
334
342
- if ((tx > 1 ) && (tools::max_value<T>() / tx < result))
335
+ if ((tx > 1 ) && (tools::max_value<T>() / tx < fabs ( result) ))
343
336
return -policies::raise_overflow_error<T>(function, nullptr , pol);
344
337
345
338
return result * tx;
@@ -417,8 +410,7 @@ inline T cyl_bessel_j_zero_imp(T v, int m, const Policy& pol)
417
410
418
411
if (number_of_iterations >= policies::get_max_root_iterations<Policy>())
419
412
{
420
- return policies::raise_evaluation_error<T>(function, " Unable to locate root in a reasonable time:"
421
- " Current best guess is %1%" , jvm, Policy ());
413
+ return policies::raise_evaluation_error<T>(function, " Unable to locate root in a reasonable time: Current best guess is %1%" , jvm, Policy ()); // LCOV_EXCL_LINE
422
414
}
423
415
424
416
return jvm;
0 commit comments