Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/erf.jl
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ function _erfinv(y::BigFloat)
isfinite(x) || return x
end
sqrtπhalf = sqrtπ * big(0.5)
tol = 2eps(abs(x))
tol = 2max(eps(abs(y)),eps(abs(x)))
while true # Newton iterations
Δx = sqrtπhalf * (erf(x) - y) * exp(x^2)
x -= Δx
Expand Down Expand Up @@ -695,7 +695,7 @@ function _erfcinv(y::BigFloat)
isfinite(x) || return x
end
sqrtπhalf = sqrtπ * big(0.5)
tol = 2eps(abs(x))
tol = 2max(eps(abs(y)),eps(abs(x)))
while true # Newton iterations
Δx = sqrtπhalf * (erfc(x) - y) * exp(x^2)
x += Δx
Expand Down
4 changes: 4 additions & 0 deletions test/erf.jl
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,10 @@
@test_throws DomainError erfinv(x)
@test_throws DomainError erfcinv(1-x)
end

# Those two values were hanging before, see issue #557
@test erfcinv(2big"0.8") ≈ erfcinv(2big(0.8)) rtol= 2eps()
@test erfcinv(2big"0.41") ≈ erfcinv(2big(0.41)) rtol= 2eps()
end

@testset "Other float types" begin
Expand Down
Loading