JuliaStats / Distributions.jl

A Julia package for probability distributions and associated functions.
Other
1.11k stars 414 forks source link

Bad convert for quantile with Poisson #1415

Open theogf opened 2 years ago

theogf commented 2 years ago

Calling quantile(Poisson(), 1) will return the following error

julia> quantile(Poisson(), 1)
ERROR: InexactError: Int64(Inf)
...

It seems to be because of the following line: https://github.com/JuliaStats/Distributions.jl/blob/586625859ce234cccbc152f00e681e5657f8a56f/src/univariates.jl#L639

devmotion commented 2 years ago

I assume the motivation for convert here is that quantile should return values that can be sampled from the distribution of interest and are in its support. However, for discrete distributions with integer-valued support this leads to problems since there is no Inf for integers.

Related: https://github.com/JuliaStats/Distributions.jl/issues/1254