cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Some patches

From: Gisle Vanem <gvanem_at_broadpark.no>
Date: Wed, 5 May 2004 15:13:50 +0200

"Daniel Stenberg" <daniel-curl_at_haxx.se> said:

> > progress.c; fixed the percent values being trunced to 0.
> > if we don't use doubles the percent calculation could overflow in
> > the X*100 step. But I assume it's safe if curl_off_t is 64-bits.
>
> Yes, but only then. With this patch, systems with 32bit file sizes will get a
> math overflow when ~40MB (2^32/100) has been transfered and then the
> percentage will be much more wrong than it is today...

But now the percentages are always 0 (at least here).

(A/B)*100 = 0, since A < B and both A and B are 32/64-bit
scalars. Wasn't this written as
 (int) (100.0*(double)A/(double)B)

at some time?

--gv
Received on 2004-05-05