Skip to content

Commit

Permalink
Allow some extra precision for numbers just above 1000 MB/s
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Oct 7, 2018
1 parent 48c1684 commit d8b72e3
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions src/main.rs
Expand Up @@ -279,12 +279,7 @@ fn throughput(dur: time::Duration, bytes: usize) -> u64 {
let mut megabytes_per_second = bytes as u64 / dur.num_microseconds().unwrap() as u64;

// Round to two significant digits.
if megabytes_per_second > 1000 {
if megabytes_per_second % 100 >= 50 {
megabytes_per_second += 100;
}
megabytes_per_second = megabytes_per_second / 100 * 100;
} else if megabytes_per_second > 100 {
if megabytes_per_second > 100 {
if megabytes_per_second % 10 >= 5 {
megabytes_per_second += 10;
}
Expand Down

0 comments on commit d8b72e3

Please sign in to comment.