Skip to content

Commit

Permalink
Update src/univariate/discrete/binomial.jl
Browse files Browse the repository at this point in the history
Co-authored-by: David Widmann <[email protected]>
  • Loading branch information
marcusps and devmotion authored Dec 16, 2024
1 parent c88c447 commit daf038d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/univariate/discrete/binomial.jl
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,10 @@ function median(dist::Binomial)

if difference <= bound
floor_mean
elseif difference >= 1 - bound
elseif difference >= 1 - bound
# The case p = 1/2 and n odd was already covered above,
# thus only cases with |median - mean| < 1 - bound are left here
# Therefore difference >= 1 - bound implies that floor(mean) cannot be the median
floor_mean + 1
elseif cdf(dist, floor_mean) >= 0.5
floor_mean
Expand Down

0 comments on commit daf038d

Please sign in to comment.