[coyotos-dev] [PATCH included] Test infrastructure for bignum
Jonathan S. Shapiro
shap at eros-os.com
Fri May 16 11:21:02 CDT 2008
I do not mean to be ignoring you, and I did not anticipate that the
delay would be this long. I am pushing very hard to get a particular
piece of the Coyotos kernel working so that we can test a new board that
just came out of prototype fabrication, and that is taking a bit longer
than I had anticipated. I'm still working on it, but I didn't want to
let this dangle.
The patch survived, and I have just looked at it. If I understand the
change correctly, then I don't understand why it is correct.
1. I want to confirm my understanding of the sign bug, because I
did not see it initially. I think the problem is not that the sign
is being lost. It's that the logic of the accumulation operation here
is completely wrong. Given:
negative = true
*this = (-0 * 10) => -0
+ 1 => 1
and the sign is immediately lost. Is this the problem?
2. Good catch on -0. In all other cases that is caught by the "BigNum
from digits" constructor. I missed it here.
One small issue. The correct processing for "all other cases" is to
immediately terminate the attempt to look for further digits. So if we
are going to adopt your logic (which is conceptually fine), then the
last bit needs to be
if (c != '0') break; // end of digits in input string.
Do you agree?
More information about the coyotos-dev