Skip to content

Commit

Permalink
Make bessel_k_prime integer order aware.
Browse files Browse the repository at this point in the history
  • Loading branch information
jzmaddock committed Feb 9, 2024
1 parent 1d1a52c commit eef497e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,14 @@ inline T bessel_k_derivative_linear(T v, T x, const bessel_int_tag& tag, Policy
return result + result2;
}

template <class T, class Policy>
inline T bessel_k_derivative_linear(T v, T x, const bessel_maybe_int_tag&, Policy pol)
{
if (floor(v) == v)
return bessel_k_derivative_linear(v, x, bessel_int_tag(), pol);
return bessel_k_derivative_linear(v, x, bessel_no_int_tag(), pol);
}

template <class T, class Tag, class Policy>
inline T bessel_y_derivative_linear(T v, T x, Tag tag, Policy pol)
{
Expand Down
16 changes: 8 additions & 8 deletions test/test_bessel_k_prime.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,31 +185,31 @@ void test_bessel(T, const char* name)
{
static const std::array<std::array<T, 3>, 8> coverage_data = { {
#if LDBL_MAX_10_EXP > 310
{{ SC_(20), static_cast<T>(ldexp(T(1), -45)), SC_(-3.793503044583520787322174911740831752794438746336004555076e308) }},
{{ SC_(20.0), static_cast<T>(ldexp(T(1), -45)), SC_(-3.793503044583520787322174911740831752794438746336004555076e308) }},
{{ SC_(20.125), static_cast<T>(ldexp(T(1), -45)), SC_(-2.979220621533376610700938325572770408419207521624698386062e310) }},
#else
{{ SC_(20), static_cast<T>(ldexp(T(1), -45)), -std::numeric_limits<T>::infinity() }},
{{ SC_(20.0), static_cast<T>(ldexp(T(1), -45)), -std::numeric_limits<T>::infinity() }},
{{ SC_(20.125), static_cast<T>(ldexp(T(1), -45)), -std::numeric_limits<T>::infinity() }},
#endif
#if LDBL_MAX_10_EXP > 346
{{ SC_(20), static_cast<T>(ldexp(T(1), -51)), SC_(-3.227155487331667007856383940813742118802894409545345203104e346) }},
{{ SC_(20.0), static_cast<T>(ldexp(T(1), -51)), SC_(-3.227155487331667007856383940813742118802894409545345203104e346) }},
{{ SC_(20.125), static_cast<T>(ldexp(T(1), -51)), SC_(-4.262404050083097364466577035647085801041781477814968803189e348) }},
#else
{{ SC_(20), static_cast<T>(ldexp(T(1), -51)), -std::numeric_limits<T>::infinity() }},
{{ SC_(20.0), static_cast<T>(ldexp(T(1), -51)), -std::numeric_limits<T>::infinity() }},
{{ SC_(20.125), static_cast<T>(ldexp(T(1), -51)), -std::numeric_limits<T>::infinity() }},
#endif
#if LDBL_MAX_10_EXP > 4971
{{ SC_(20), static_cast<T>(ldexp(T(1), -778)), SC_(-2.15657066125095338369788943003323297569772178814715617602e4942) }},
{{ SC_(20.0), static_cast<T>(ldexp(T(1), -778)), SC_(-2.15657066125095338369788943003323297569772178814715617602e4942) }},
{{ SC_(20.125), static_cast<T>(ldexp(T(1), -778)), SC_(-6.46694658438021098575183049117626387183087801364084017400e4971) }},
#else
{{ SC_(20), static_cast<T>(ldexp(T(1), -778)), -std::numeric_limits<T>::infinity() }},
{{ SC_(20.0), static_cast<T>(ldexp(T(1), -778)), -std::numeric_limits<T>::infinity() }},
{{ SC_(20.125), static_cast<T>(ldexp(T(1), -778)), -std::numeric_limits<T>::infinity() }},
#endif
#if LDBL_MAX_10_EXP > 5493
{{ SC_(20), static_cast<T>(ldexp(T(1), -860)), SC_(-5.09819245599453059425108127687500966644642217657888061634e5460) }},
{{ SC_(20.0), static_cast<T>(ldexp(T(1), -860)), SC_(-5.09819245599453059425108127687500966644642217657888061634e5460) }},
{{ SC_(20.125), static_cast<T>(ldexp(T(1), -860)), SC_(-1.86169813082884487070647108868007382252541071831005047607e5493) }},
#else
{{ SC_(20), static_cast<T>(ldexp(T(1), -860)), -std::numeric_limits<T>::infinity() }},
{{ SC_(20.0), static_cast<T>(ldexp(T(1), -860)), -std::numeric_limits<T>::infinity() }},
{{ SC_(20.125), static_cast<T>(ldexp(T(1), -860)), -std::numeric_limits<T>::infinity() }},
#endif
} };
Expand Down

0 comments on commit eef497e

Please sign in to comment.