Skip to content

Commit 5ae131e

Browse files
committed
fix dispatch
1 parent e8f78ef commit 5ae131e

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/besselj.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,10 +348,10 @@ In general, this is most accurate for small arguments and when nu > x.
348348
function besselj_power_series(v, x::T) where T
349349
MaxIter = 3000
350350
S = promote_type(T, Float64)
351-
x = S(x)
351+
v, x = S(v), S(x)
352352

353353
out = zero(S)
354-
a = (x/2)^v / gamma(v + 1)
354+
a = (x/2)^v / gamma(v + one(S))
355355
t2 = (x/2)^2
356356
for i in 0:MaxIter
357357
out += a

src/gamma.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Adapted from Cephes Mathematical Library (MIT license https://en.smath.com/view/CephesMathLibrary/license) by Stephen L. Moshier
22
gamma(x::Float64) = _gamma(x)
3-
_gamma(x::Float32) = Float32(_gamma(Float64(x)))
3+
gamma(x::Float32) = Float32(_gamma(Float64(x)))
44

55
function _gamma(x::Float64)
66
T = Float64
@@ -52,7 +52,7 @@ end
5252

5353
function gamma(n::Integer)
5454
n < 0 && throw(DomainError(n, "`n` must not be negative."))
55-
n == 0 && return Inf*float(n)
55+
n == 0 && return Inf*one(n)
5656
n > 20 && return gamma(float(n))
5757
@inbounds return Float64(factorial(n-1))
5858
end

0 commit comments

Comments
 (0)