Skip to content

Commit

Permalink
Merge pull request #15 from marshallpierce/simplify-num_bins
Browse files Browse the repository at this point in the history
Use sub_bucket_half_count instead of dividing sub_bucket_count
  • Loading branch information
jonhoo authored Feb 18, 2017
2 parents 6494f3c + 4b6d1e5 commit ed7f3e0
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1276,8 +1276,7 @@ impl<T: Counter> Histogram<T> {
/// Or, equivalently, we need 1 more bucket to capture the max value if we consider the
/// sub-bucket length to be halved.
fn num_bins(&self, number_of_buckets: u8) -> u32 {
// TODO use sub_bucket_half_count
(number_of_buckets as u32 + 1) * (self.sub_bucket_count / 2)
(number_of_buckets as u32 + 1) * (self.sub_bucket_half_count)
}

/// Compute the number of buckets needed to cover the given value, as well as the total number
Expand Down

0 comments on commit ed7f3e0

Please sign in to comment.