Skip to content

Commit fe0a044

Browse files
committed
fix type issues
1 parent 9889d2a commit fe0a044

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/sphericalbessel.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ function sphericalbesselj_small_args(nu, x::T) where T
6161
iszero(x) && return iszero(nu) ? one(T) : zero(T)
6262
x2 = x^2 / 4
6363
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))
6565
return x^nu * a * coef
6666
end
6767

@@ -92,7 +92,7 @@ function sphericalbesselj_recurrence(nu::Integer, x::T) where T
9292
elseif x < nu
9393
# compute sphericalbessely with forward recurrence and use continued fraction
9494
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)
9696
return inv(x^2 * (H*sYnm1 - sYn))
9797
end
9898
end
@@ -132,7 +132,7 @@ sphericalbessely_positive_args(nu::Real, x) = isinteger(nu) ? sphericalbessely_p
132132
function sphericalbessely_positive_args(nu::Integer, x::T) where T
133133
if besseljy_debye_cutoff(nu, x)
134134
# 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)
136136
elseif nu < 250
137137
return sphericalbessely_forward_recurrence(nu, x)[1]
138138
else
@@ -158,5 +158,5 @@ function sphericalbessely_forward_recurrence(nu::Integer, x::T) where T
158158
# need to check if NaN resulted during loop
159159
# this could happen if x is very small and nu is large which eventually results in overflow (-> -Inf)
160160
# 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)
162162
end

0 commit comments

Comments
 (0)