Skip to content

Commit

Permalink
fix promote for Float32 case
Browse files Browse the repository at this point in the history
  • Loading branch information
songjhaha committed Feb 29, 2024
1 parent bac854b commit 7ff5ee1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/expint.jl
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ En_safe_gamma_term(ν::Integer, z::Real) = (z ≥ 0 || isodd(ν) ? 1 : -1) * exp
# https://functions.wolfram.com/GammaBetaErf/ExpIntegralE/10/0005/
# returns the two terms from the above equation separately
function En_cf_gamma::Number, z::Number, n::Int=1000)
A, z = map(float, promote(float(1 - ν), z))
A, z = map(float, promote(1 - ν, z))
B = oneunit(A)
Bprev = zero(B)
Aprev = oneunit(A)
Expand Down
3 changes: 3 additions & 0 deletions test/expint.jl
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@ using Base.MathConstants
end
# type stability
@inferred SpecialFunctions.En_cf_gamma(1, 1.0 + 2.1im, 1000)
@test SpecialFunctions.En_cf_gamma(1, 1.0 + 2.1im, 1000) isa Tuple{ComplexF64,ComplexF64,Int}
@inferred SpecialFunctions.En_cf_gamma(1, 1.0f0, 1000)
@test SpecialFunctions.En_cf_gamma(1, 1.0f0, 1000) isa Tuple{Float32,Float32,Int}
end
@testset "En_expand_origin" begin
for (x, y) in zip(xs, ys)
Expand Down

0 comments on commit 7ff5ee1

Please sign in to comment.