about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRichard Nyberg <rnyberg@murmeldjur.se>2006-09-16 10:33:35 +0000
committerRichard Nyberg <rnyberg@murmeldjur.se>2006-09-16 10:33:35 +0000
commitb0d013a7aa9e7f58547a2be56400c7f9d34edec2 (patch)
treeed3d6833c78d337e6d372acda1b1e0956212d10e
parent2483f77ff5a17344ebf22aaabc2e3cd3d207060a (diff)
downloadbtpd-b0d013a7aa9e7f58547a2be56400c7f9d34edec2.tar.gz
btpd-b0d013a7aa9e7f58547a2be56400c7f9d34edec2.zip
Make tests for unit changes to take rounding into account.
-rw-r--r--cli/stat.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/cli/stat.c b/cli/stat.c
index d7bdd31..96f85c7 100644
--- a/cli/stat.c
+++ b/cli/stat.c
@@ -68,17 +68,16 @@ print_percent(long long part, long long whole)
 static void
 print_rate(long long rate)
 {
-    if (rate >= (1000 << 10))
+    if (rate >= 999.995 * (1 << 10))
         printf("%6.2fMB/s ", (double)rate / (1 << 20));
     else
         printf("%6.2fkB/s ", (double)rate / (1 << 10));
-
 }
 
 static void
 print_size(long long size)
 {
-    if (size >= (1000 << 20))
+    if (size >= 999.995 * (1 << 20))
         printf("%6.2fG ", (double)size / (1 << 30));
     else
         printf("%6.2fM ", (double)size / (1 << 20));