Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #1358 #1359

Merged
merged 2 commits into from
Jul 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Distributions"
uuid = "31c24e10-a181-5473-b8eb-7969acd0382f"
authors = ["JuliaStats"]
version = "0.25.8"
version = "0.25.9"

[deps]
FillArrays = "1a297f60-69ca-5386-bcde-b61e274b549b"
Expand Down
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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this overwritten somewhere for discrete distributions which are not supported on the integers?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, but the macro that forwards calculations to StatsFuns is only used for discrete distributions with integer valued support.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR only fixes the issue that was introduced in 0.25.7 when the eval parts of the macro where removed but does not introduce any new behaviour.


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