SpecialFunctions.jl
SpecialFunctions.jl copied to clipboard
erfcx(BigFloat) misses a connection segment
Plots.plot(20000:40000,erfcx.(BigFloat(20000):40000), yaxis=:log)

Rather than a plot, can you just give a single point where it is not giving the expected output?
NaN begins from 27282 and ends at 32768 (only counted integer values).
julia> erfcx(BigFloat(27281))
2.068067824378598630288975599374805428229073376310733390485590903274295760840468e-05
julia> erfcx(BigFloat(27282))
NaN
julia> erfcx(BigFloat(32768))
NaN
julia> erfcx(BigFloat(32769))
1.721717425875220708758243853735950836098892035259101544766730697542870688938946e-05
It seems the heuristic in https://github.com/JuliaMath/SpecialFunctions.jl/blob/a1df96daaeae3ec663593a7c2d76f4245725ac5e/src/erf.jl#L52 is wrong and internal overflow occurs also for values less than or equal to 0x1p15 = 32768.