I develop own big_int class. It is a study task. I implemented +
, -
, and *
ops. It works well and fast. But I have some troubles with implementation of big numbers division.
I implemented division, as the difference between the numbers (pseudocode):
big_int division (big_int first_number, big_int second_number) {
big_int counter = 0
while (second_number <= first_number) {
first_number -= second_number;
counter++;
}
return counter;
}
It works only for small numbers. But my test numbers have length not greater than 100.
I present my number as array with base = 10
. For example, 113
equal to number[3] = {1, 1, 3};