I have a Julia 1.1 application I’m upgrading to 1.7
Here is some code:
using Distributions
g = Distributions.Gamma(0.004190129634501312, 0.00043125955824484334)
q = 0.0444788802702531
Distributions.quantile(g, q)
Under 1.1, Distribution package v0.18, the output is 0.0
Under 1.7, Distribution package v0.25.52 the output is:
DomainError with -1.606e-320:
log will only return a complex result if called with a complex argument. Try log(Complex(x)).
Stacktrace:
[1] throw_complex_domainerror(f::Symbol, x::Float64)
@ Base.Math .\math.jl:33
[2] _log(x::Float64, base::Val{:ℯ}, func::Symbol)
@ Base.Math .\special\log.jl:304
[3] log
@ .\special\log.jl:269 [inlined]
[4] __gamma_inc_inv(a::Float64, minpq::Float64, pcase::Bool)
@ SpecialFunctions C:\Program Files\ReSolver.DistributedJulia\depot\packages\SpecialFunctions\CQMHW\src\gamma_inc.jl:1048
[5] _gamma_inc_inv
@ C:\Program Files\ReSolver.DistributedJulia\depot\packages\SpecialFunctions\CQMHW\src\gamma_inc.jl:1012 [inlined]
[6] gamma_inc_inv
@ C:\Program Files\ReSolver.DistributedJulia\depot\packages\SpecialFunctions\CQMHW\src\gamma_inc.jl:994 [inlined]
[7] gammainvcdf
@ C:\Program Files\ReSolver.DistributedJulia\depot\packages\StatsFuns\dTYga\src\distrs\gamma.jl:98 [inlined]
[8] quantile(d::Gamma{Float64}, q::Float64)
@ Distributions C:\Program Files\ReSolver.DistributedJulia\depot\packages\Distributions\DiPwc\src\univariates.jl:627
My question is:
- Is there a way of doing this without getting the error and getting 0.0 instead to maintain consistency?
- Obviously I’m dealing with small numbers here - should I just
try/catch
theDomainError
and return 0?
Thanks