BigInt icon indicating copy to clipboard operation
BigInt copied to clipboard

Invalid string access on modulo

Open mristin opened this issue 2 years ago • 2 comments

The following modulo computation causes an invalid string access in the library:

#include "BigInt.hpp"

#include <iostream>

int main() {
    BigInt number("12345678901234567890123456789012345678901234567889");
    std::cout << number % 4 << std::endl;
    return 0;
}

mristin avatar Mar 06 '24 21:03 mristin

I attempted to run it myself with v0.5.0-dev and the code you provided, and it successfully compiled, ran, and returned 1 as an answer. It may be that the issue is fixed now.

formerlytomato avatar Nov 15 '24 19:11 formerlytomato

It is also working in v0.4.0-dev: https://wandbox.org/permlink/a2dcxioVLxAxkS9f

@mristin Can you please share which OS, compiler, and CPU you were using?

faheel avatar Nov 19 '24 04:11 faheel