Skip to content

Commit

Permalink
Geometric parameter should be on (0, 1] (#1906)
Browse files Browse the repository at this point in the history
* Geometric parameter should be on (0, 1]

* add tests

* patch bump
  • Loading branch information
palday authored Nov 4, 2024
1 parent a1010e4 commit aad64af
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
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.112"
version = "0.25.113"

[deps]
AliasTables = "66dad0bd-aa9a-41b7-9441-69ab47430ed8"
Expand Down
2 changes: 1 addition & 1 deletion src/univariate/discrete/geometric.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ struct Geometric{T<:Real} <: DiscreteUnivariateDistribution
end

function Geometric(p::Real; check_args::Bool=true)
@check_args Geometric (p, zero(p) < p < one(p))
@check_args Geometric (p, zero(p) < p <= one(p))
return Geometric{typeof(p)}(p)
end

Expand Down
5 changes: 5 additions & 0 deletions test/univariate/discrete/geometric.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,8 @@ using FiniteDifferences
test_cgf(Geometric(0.1), (1f-1, -1e6))
test_cgf(Geometric(0.5), (1f-1, -1e6))
end

@testset "Support" begin
@test rand(Geometric(1)) == 0
@test_throws DomainError Geometric(0)
end

2 comments on commit aad64af

@palday
Copy link
Member Author

@palday palday commented on aad64af Nov 4, 2024

Choose a reason for hiding this comment

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

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

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

Registration pull request created: JuliaRegistries/General/118686

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.25.113 -m "<description of version>" aad64af36e83f9a191de34f497e584943ffa84e5
git push origin v0.25.113

Please sign in to comment.