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 daf038d commit 04bd121
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/univariate/discrete/binomial.jl
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ function median(dist::Binomial)
difference = dist_mean - floor_mean

if difference <= bound
# The only case where the median satisfies |median - mean| <= 1 - bound with equality
# is p = 1/2 and n odd
# However, in that case we also want to return floor(mean)
floor_mean
elseif difference >= 1 - bound
# The case p = 1/2 and n odd was already covered above,
Expand Down

0 comments on commit 04bd121

Please sign in to comment.