int128_t.hpp
int128_t int128_t::DivideDouble(int128_t *A,const int128_t &B)
{
    int128 quotient=*A;
    int128 remainder;//==0

    if ((int128_t)(B)==0) //TODO: fix this const mess
    {
        throw "division by zero";
    }
    
    for (int x=0;x<A->size;x++)
    {
        int hibit=shiftleft(&quotient,0);
        shiftleft(&remainder,hibit);
        if (remainder>=B)
        {
            SubDouble(&remainder,B,0); //remainder-=*B;
            quotient.Lo|=1; //quotient|=1;
        }
    }

    *A=quotient;
    return remainder;
}
// from what I understand there are really only a couple of algorithms
// useful for really long integer divides. My original plan was to 
// do some form of broken up radix 2^64 divide, but that doesn't actually
// work without making sure the dividend is less than 2^64, if thats the case
// we could make a really fast arbitrarily long dividend division. I'm afraid I don't
// want to make that restriction so, I'm back to the old school, shift and subtract method.
// A=A/B Ret=Remainder
from what I understand there are really only a couple of algorithms
useful for really long integer divides. My original plan was to
do some form of broken up radix 2^64 divide, but that doesn't actually
work without making sure the dividend is less than 2^64, if thats the case
we could make a really fast arbitrarily long dividend division. I'm afraid I don't
want to make that restriction so, I'm back to the old school, shift and subtract method.
A=A/B Ret=Remainder
from what I understand there are really only a couple of algorithms useful for really long integer divides . My original plan was to do some form of broken up radix 2^64 divide but that doesn ' t actually work without making sure the dividend is less than 2^64 if thats the case we could make a really fast arbitrarily long dividend division . I ' m afraid I don ' t want to make that restriction so I ' m back to the old school shift and subtract method . A = A / B Ret = Remainder
int128_t int128_t::DivideDouble(int128_t *A,const int128_t &B)
{
    int128 quotient=*A;
    int128 remainder;
    if ((int128_t)(B)==0) 
    {
        throw "division by zero";
    }
    for (int x=0;x<A->size;x++)
    {
        int hibit=shiftleft(&quotient,0);
        shiftleft(&remainder,hibit);
        if (remainder>=B)
        {
            SubDouble(&remainder,B,0); 
            quotient.Lo|=1; 
        }
    }
    *A=quotient;
    return remainder;
}
int128_t int128_t :: DivideDouble ( int128_t * A , const int128_t & B ) { int128 quotient = * A ; int128 remainder ; if ( ( int128_t ) ( B ) == 0 ) { throw " " ; } for ( int x = 0 ; x < A -> size ; x ++ ) { int hibit = shiftleft ( & quotient , 0 ) ; shiftleft ( & remainder , hibit ) ; if ( remainder >= B ) { SubDouble ( & remainder , B , 0 ) ; quotient . Lo |= 1 ; } } * A = quotient ; return remainder ; }
from what I understand there are really only a couple of algorithms
useful for really long integer divides.
from what I understand there are really only a couple of algorithms useful for really long integer divides .
//==0 //TODO: fix this const mess //remainder-=*B; //quotient|=1;