error % operator

  • the % operator with the RossiBigInt class gives a strange error message
    I am trying to take % for a large number it fails, when I use small numbers every thing goes ok
    Isn't this supposed to be a large integer library

    I use Linux Slamd64, it is clear that my arch is x86_64
    I use Intel core 2 due processor, actually I am not thinking that this may cause the problem
    because the source code is supposed to be portable

    any way i am attaching the program the causes the error

    RossiBigInt gcd(RossiBigInt a , RossiBigInt b)
            while ( b != RossiBigInt("0",DEC_DIGIT)  )
                    RossiBigInt temp = a;
                    a = b;
                    b = temp %  b;


            return a;

    int main()
            RossiBigInt x("68234708273408273408572304857034987032498570394875023948570",DEC_DIGIT);
            RossiBigInt y("24",DEC_DIGIT);

            return 0;

    I use this line to compile
    g++ test.cpp bigint.o -o test

    This is the error message that comeout

    test: bigint.cpp:1563: RossiBigInt RossiBigInt::Divide(const RossiBigInt&, const RossiBigInt&, RossiBigInt*) const: Assertion `(quotient * divisor_i + remainder) == dividend_i' failed.

    can any one help me

    • It seems that I have solved the problem.
      as I think the problem comes because the code is not fully portable for 64bit architectures
      I have just recompiled the package for compatibility with 32bit

      I have added -m32 to the compilation flags
      and -m32 to the ldflag and every thing goes ok

      I think the writer of the code has to do some job to take in mind other architecture to produce protable code!!

    • Alex Vinokur
      Alex Vinokur

      C++ BigInt Class: Release 3.0 is availble now at