From 5578d18e2b3ae73c18fd3bff4f55fcaa7b83a8f9 Mon Sep 17 00:00:00 2001 From: simon Date: Sat, 8 Sep 2001 15:16:30 +0000 Subject: [PATCH] Fix potential float screwup in scp percentage indicator. (Don't compute (100*a)/b. Instead compute 100*(a/b), because that way there's no chance that 100*a will become inexact enough to fail to yield 100 when a==b.) git-svn-id: svn://svn.tartarus.org/sgt/putty@1254 cda61777-01e9-0310-a592-d414129be87e --- scp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scp.c b/scp.c index 5537ef33..aca1cf39 100644 --- a/scp.c +++ b/scp.c @@ -649,7 +649,7 @@ static void print_stats(char *name, unsigned long size, unsigned long done, sprintf(etastr, "%02ld:%02ld:%02ld", eta / 3600, (eta % 3600) / 60, eta % 60); - pct = (int) (100.0 * (float) done / size); + pct = (int) (100 * (done * 1.0 / size)); len = printf("\r%-25.25s | %10ld kB | %5.1f kB/s | ETA: %8s | %3d%%", name, done / 1024, ratebs / 1024.0, etastr, pct); -- 2.11.0