[coyotos-dev] BigNum.cxx buglet?
Jonathan S. Shapiro
shap at eros-os.com
Sun Sep 30 15:05:36 EDT 2007
On Sun, 2007-09-30 at 20:34 +0200, Thomas Stratmann wrote:
>
> Having corrected myself, my original description of the error should
> make sense now. (look ten lines above for
>
> q.len = (dividend.len - divisor.len + 1);
>
> and think of the case divident.len==1, divident.oneDigit==255,
> divisor.len==2, divident's digits being 0, 10 to represent "10")
I don't think that can happen, because the test using vu_cmp() above
this point... Oh. I see. Yes. The problem is the vector length rather
than the respective magnitudes. Given leading zeroes the right thing
here is to use max(dividend.len, divisor.len).
Concur? [I don't want to blow out three updates today, so might as well ask first.]
> This means that the "q.len =..." line is a bug because the leading zero
> case is not taken care of, right?
Yes.
--
Jonathan S. Shapiro
Managing Director
The EROS Group, LLC
www.coyotos.org, www.eros-os.org
More information about the coyotos-dev
mailing list