Skip to content

Commit

Permalink
Further simplifications following suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
marcusps authored Dec 16, 2024
1 parent b4647c2 commit 59ff74c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/univariate/discrete/binomial.jl
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,11 @@ function median(dist::Binomial)
dist_mean = mean(dist)

floor_mean = floor(Int, dist_mean)

if dist_mean - floor_mean < bound
difference = dist_mean - floor_mean

if difference < bound
floor_mean
elseif floor_mean + 1 - dist_mean < bound
elseif difference > 1 - bound
floor_mean + 1
elseif cdf(dist, floor_mean) >= 0.5
floor_mean
Expand Down

0 comments on commit 59ff74c

Please sign in to comment.