Skip to content

Commit

Permalink
Fix #1358
Browse files Browse the repository at this point in the history
  • Loading branch information
devmotion committed Jul 4, 2021
1 parent 34df63d commit 31a84ba
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/univariates.jl
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,7 @@ macro _delegate_statsfuns(D, fpre, psyms...)
pargs = [Expr(:(.), :d, Expr(:quote, s)) for s in psyms]

# output type of `quantile` etc.
T = :($D isa DiscreteUnivariateDistribution ? Int : Real)
T = :($D <: DiscreteUnivariateDistribution ? Int : Real)

return quote
$Distributions.pdf(d::$D, x::Real) = $(fpdf)($(pargs...), x)
Expand Down
9 changes: 9 additions & 0 deletions test/univariates.jl
Original file line number Diff line number Diff line change
Expand Up @@ -166,3 +166,12 @@ for c in ["discrete",
verify_and_test_drive(jsonfile, ARGS, 10^6)
println()
end

# #1358
@testset "Poisson quantile" begin
d = Poisson(1)
@test quantile(d, 0.2) isa Int
@test cquantile(d, 0.4) isa Int
@test invlogcdf(d, log(0.2)) isa Int
@test invlogccdf(d, log(0.6)) isa Int
end

0 comments on commit 31a84ba

Please sign in to comment.