Skip to content

Commit db0ee77

Browse files
committed
fix another spurious expint domainerror
1 parent 9f230e6 commit db0ee77

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/expint.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,11 @@ function En_cf_nogamma(ν::Number, z::Number, n::Int=1000)
188188

189189
exppart = exp(-z)
190190
if isinf(exppart)
191-
return exp(-z + log(A) - log(B)), iters
191+
if A isa Real
192+
return sign(A)*sign(B)*exp(-z + log(abs(A)) - log(abs(B))), iters
193+
else
194+
exp(-z + log(A) - log(B)), iters
195+
end
192196
else
193197
cfpart = A/B
194198
return cfpart * exppart, iters

test/expint.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ using Base.MathConstants
130130
@test expint(-2.2, 3.2) 0.024950173497409329191241353395358 rtol=1e-14
131131
@test expint(+2.2, 3.2) 0.008044603700773423319087602010 rtol=1e-12
132132
@test expint(3.2, 1.3) 0.070147692224611216675759479422283315452559216337905 rtol=1e-14
133+
@test expint(-20, -1000) === -Inf
133134
end
134135

135136
expinti_real(x) = invoke(expinti, Tuple{Real}, x)

0 commit comments

Comments
 (0)