Skip to content

Commit

Permalink
Merge pull request #956 from facorread/patch-1
Browse files Browse the repository at this point in the history
Rounding error fix on WeightedIndex::update_weights()
  • Loading branch information
dhardy committed Mar 27, 2020
2 parents d0a584c + 4679f05 commit 2962dea
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/distributions/weighted_index.rs
Expand Up @@ -174,7 +174,7 @@ impl<X: SampleUniform + PartialOrd> WeightedIndex<X> {
total_weight += w;
prev_i = Some(i);
}
if total_weight == zero {
if total_weight <= zero {
return Err(WeightedError::AllWeightsZero);
}

Expand Down

0 comments on commit 2962dea

Please sign in to comment.