I have the basics down on my integer class. (addition and multiplication, subtraction and division I'm putting on hold until i get everything else right.)
the thing is i can only compute up to 8! before it begins to crash.
Sometomes it gets 8! correct, other times it crashes,
still others it gets it totally wrong like:
8! = 403225306
or
8! = 4032-14423
I don't understand what is going on. Coule someone please help me? All I wanted to do was take a short break and write a simple bignum class and this is driving me crazy.
I think I see a problem with your resize() function. If the new size is > the old size then you are exceeding array bounds in the for loop.
1 2 3 4 5 6 7 8 9 10
bool integer::resize(very long ns)
{
integer copy(*this);
size = ns;
delete [] d;
d = newshort [size];
for (int i = 0; i < size; ++i)
d[i] = copy.d[i];// copy has only this->size elements allocated to it. If size > this->size then segfault!
returntrue;
}