Skip to content

Discrete distributions CDF does not support Inf input #1073

@sparktseung

Description

@sparktseung

I am using Poisson and NegativeBinomial distributions, and it seems that their cdf and logcdf do not support Inf as x input, while pdf and logpdf seem to work fine. The following is an example. It seems natural to require cdf and logcdf to return 1.0 and 0.0, respectively.

julia> pdf(Poisson(5.0), Inf)

0.0

julia> cdf(Poisson(5.0), Inf)
ERROR: InexactError: trunc(Int64, Inf)
Stacktrace:
 [1] trunc at .\float.jl:702 [inlined]
 [2] floor at .\float.jl:363 [inlined]
 [3] cdf(::Poisson{Float64}, ::Float64) at ...\.julia\packages\Distributions\kPXE9\src\univariates.jl:378
 [4] top-level scope at none:0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions