Skip to content

Commit aad64af

Browse files
authored
Geometric parameter should be on (0, 1] (#1906)
* Geometric parameter should be on (0, 1] * add tests * patch bump
1 parent a1010e4 commit aad64af

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "Distributions"
22
uuid = "31c24e10-a181-5473-b8eb-7969acd0382f"
33
authors = ["JuliaStats"]
4-
version = "0.25.112"
4+
version = "0.25.113"
55

66
[deps]
77
AliasTables = "66dad0bd-aa9a-41b7-9441-69ab47430ed8"

src/univariate/discrete/geometric.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ struct Geometric{T<:Real} <: DiscreteUnivariateDistribution
3030
end
3131

3232
function Geometric(p::Real; check_args::Bool=true)
33-
@check_args Geometric (p, zero(p) < p < one(p))
33+
@check_args Geometric (p, zero(p) < p <= one(p))
3434
return Geometric{typeof(p)}(p)
3535
end
3636

test/univariate/discrete/geometric.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,8 @@ using FiniteDifferences
1818
test_cgf(Geometric(0.1), (1f-1, -1e6))
1919
test_cgf(Geometric(0.5), (1f-1, -1e6))
2020
end
21+
22+
@testset "Support" begin
23+
@test rand(Geometric(1)) == 0
24+
@test_throws DomainError Geometric(0)
25+
end

0 commit comments

Comments
 (0)