Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

HugeMotherFuckingInt

Name: Anonymous 2011-08-15 7:48

I'm trying to write a HugeMotherFuckingInt processing library in C.

My first try, I stored the numbers as a char[] and computed them using basic arithmetic.

My second try, I stored the numbers as unsigned long char[]. This proved to be a faster, easier and clearer approach.

Still though, it seems to be a bit too slow.

What other data structures might result in faster execution of basic arithmetic +/*-?

Also, are there any algorithms to speed up the arithmetic operations themselves?

Name: n3n7i 2011-08-16 7:01

...It's working again =)

Anyone Got some big (Hopefully easy to enter) Numbers?

eg 1, 1, 1, 1, is Equiv to 1, 000,000,001, 000,000,001, 000,000,001

Doing multiply at least...

Name: n3n7i 2011-08-16 7:43

...Here's a kind of fast multiply



Darn backseat Coders, Get your own text editor =)







void FSMultiply(int xa[], int xb[], int xc[]){
int mCount[52], VAdd[52], VCount[52], FStore[52], FCount[52], OldStore[52];

One(mCount);
//Zero(OldCount);
Zero(OldStore);
Zero(FCount);
Zero(FStore);

if(isLarger(xa, xb)>=0){
    Set(VCount, xb);
    Set(VAdd, xa);
    } else{
    Set(VAdd, xb);
    Set(VCount, xa);
    }

while(isLarger(VCount, aZero)==1){
    One(mCount);

    //printf("ONED m:");
    //Printout(mCount);
    //printf("Remainder V:");
    //Printout(VCount);
    //printf("VADD:");
    //Printout(VAdd);   
    //Pause();

    Set(FStore, VAdd);
    if(isLarger(VCount, mCount)==0){
        Add(xc, VAdd, xc);
        Sub(VCount, mCount, VCount);

        //printf("plus 1\nDone!");
        Printout(xc);
        return;
        }

    while(isLarger(VCount, mCount)>=0){
        Set(FCount, mCount);
        Set(OldStore, FStore);
        Add(mCount, mCount, mCount);
        Add(FStore, FStore, FStore);

        //printf("FC:");
        //Printout(FCount);
        //printf("OS:");
        //Printout(OldStore);
        //Pause();
   
        Sub(VCount, FCount, VCount);
        Add(xc, OldStore, xc);
        }   
   
   
    //printf("\nVC:");
    //Printout(VCount);
    //printf("\nxc:");
    //Printout(xc);
    //Pause();

    }
}

//====================================

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List