Browse Source

Make tests for unit changes to take rounding into account.

master
Richard Nyberg 18 years ago
parent
commit
b0d013a7aa
1 changed files with 2 additions and 3 deletions
  1. +2
    -3
      cli/stat.c

+ 2
- 3
cli/stat.c View File

@@ -68,17 +68,16 @@ print_percent(long long part, long long whole)
static void static void
print_rate(long long rate) print_rate(long long rate)
{ {
if (rate >= (1000 << 10))
if (rate >= 999.995 * (1 << 10))
printf("%6.2fMB/s ", (double)rate / (1 << 20)); printf("%6.2fMB/s ", (double)rate / (1 << 20));
else else
printf("%6.2fkB/s ", (double)rate / (1 << 10)); printf("%6.2fkB/s ", (double)rate / (1 << 10));

} }


static void static void
print_size(long long size) print_size(long long size)
{ {
if (size >= (1000 << 20))
if (size >= 999.995 * (1 << 20))
printf("%6.2fG ", (double)size / (1 << 30)); printf("%6.2fG ", (double)size / (1 << 30));
else else
printf("%6.2fM ", (double)size / (1 << 20)); printf("%6.2fM ", (double)size / (1 << 20));


Loading…
Cancel
Save