@@ -61,7 +61,7 @@ function sphericalbesselj_small_args(nu, x::T) where T
61
61
iszero (x) && return iszero (nu) ? one (T) : zero (T)
62
62
x2 = x^ 2 / 4
63
63
coef = evalpoly (x2, (1 , - inv (T (3 )/ 2 + nu), - inv (5 + nu), - inv (T (21 )/ 2 + nu), - inv (18 + nu)))
64
- a = sqrt ( T ( pi ) / 2 ) / (gamma (T (3 )/ 2 + nu) * 2 ^ (nu + T (1 )/ 2 ))
64
+ a = SQPIO2 (T ) / (gamma (T (3 )/ 2 + nu) * 2 ^ (nu + T (1 )/ 2 ))
65
65
return x^ nu * a * coef
66
66
end
67
67
@@ -92,7 +92,7 @@ function sphericalbesselj_recurrence(nu::Integer, x::T) where T
92
92
elseif x < nu
93
93
# compute sphericalbessely with forward recurrence and use continued fraction
94
94
sYnm1, sYn = sphericalbessely_forward_recurrence (nu, x)
95
- H = besselj_ratio_jnu_jnum1 (nu + 3 / 2 , x)
95
+ H = besselj_ratio_jnu_jnum1 (nu + T ( 3 ) / 2 , x)
96
96
return inv (x^ 2 * (H* sYnm1 - sYn))
97
97
end
98
98
end
@@ -132,7 +132,7 @@ sphericalbessely_positive_args(nu::Real, x) = isinteger(nu) ? sphericalbessely_p
132
132
function sphericalbessely_positive_args (nu:: Integer , x:: T ) where T
133
133
if besseljy_debye_cutoff (nu, x)
134
134
# for very large orders use expansion nu >> x to avoid overflow in recurrence
135
- return SQPIO2 (T) * besseljy_debye (nu + 1 / 2 , x)[2 ] / sqrt (x)
135
+ return SQPIO2 (T) * besseljy_debye (nu + one (T) / 2 , x)[2 ] / sqrt (x)
136
136
elseif nu < 250
137
137
return sphericalbessely_forward_recurrence (nu, x)[1 ]
138
138
else
@@ -158,5 +158,5 @@ function sphericalbessely_forward_recurrence(nu::Integer, x::T) where T
158
158
# need to check if NaN resulted during loop
159
159
# this could happen if x is very small and nu is large which eventually results in overflow (-> -Inf)
160
160
# NaN inputs were checked in top level function so if sY0 is NaN we should return -infinity
161
- return isnan (sY0) ? (- Inf , - Inf ) : (sY0, sY1)
161
+ return isnan (sY0) ? (- T ( Inf ) , - T ( Inf ) ) : (sY0, sY1)
162
162
end
0 commit comments