From e884847f19f24373300b564b571ff12a865739d3 Mon Sep 17 00:00:00 2001 From: Phillip Alday Date: Tue, 1 Oct 2024 02:09:07 +0000 Subject: [PATCH 1/3] Geometric parameter should be on (0, 1] --- src/univariate/discrete/geometric.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/univariate/discrete/geometric.jl b/src/univariate/discrete/geometric.jl index f89cebfedd..f7f940ee4b 100644 --- a/src/univariate/discrete/geometric.jl +++ b/src/univariate/discrete/geometric.jl @@ -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 From d61ec716156795c0b8f2d3e92bacc5182025dbfe Mon Sep 17 00:00:00 2001 From: Phillip Alday Date: Mon, 4 Nov 2024 13:55:20 -0600 Subject: [PATCH 2/3] add tests --- test/univariate/discrete/geometric.jl | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/univariate/discrete/geometric.jl b/test/univariate/discrete/geometric.jl index 9845946db7..82f7a1e2ce 100644 --- a/test/univariate/discrete/geometric.jl +++ b/test/univariate/discrete/geometric.jl @@ -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 From 16edf06a83ba602a313760777ed3721b1d0ed057 Mon Sep 17 00:00:00 2001 From: Phillip Alday Date: Mon, 4 Nov 2024 13:56:03 -0600 Subject: [PATCH 3/3] patch bump --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 5cda146036..341fb436c1 100644 --- a/Project.toml +++ b/Project.toml @@ -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"