the idea is this:
the operators *, simulates digit by digit multiplication operation;
for example, the extreme condition is given by a multiplication between two integers, the single figure compounds '9'.
Ex. 9999 x 99;
performing this multiplication, we have:
1 2 3
|
9999 * 4 digits
99 = 2 digits
|
1 2 3 4
|
089 991 6 digits
899 910 6 digits (here intervenes the 'shift' variable)
------------
989 901 6 digits
|
the class 'clk', by inserting a string, each algebraic operation actor. after which it is called 'operators *' and then (in my opinion) this happens:
clk A, B clk;
A * B call ---> clk & operator * (const clk & a);
in 'operator *' A becomes the current object (* this), and B becomes the object passed within 'operator *' (const clk & a) ...
It is created inside the operator 'clk' r = {r_size}, who in 'dgt' insert:
- Size of the first operand (ex: 9999 -> dgt_size = 4),
- Size of the second operand (ex: 99 -> A.dgt_size = 2).
x = 6
for entering all the digits, I need r_size is equal to:
r_size = x + a.dgt_size * x + x = x * (a_dgt_size + 2);
The shift variable, does nothing but move left (but being the carrier ordained contrary to shift to the right) to the figures obtained in the partial results.
the final result is given by the simulation of the sum in the column of the individual digits of the partial results.
So the size of 'r', should already be scheduled for construction.
in the end is created 'clk' t, which is only transferred to the final result, content of 'r', in order not to complicate the succeessive multiplication operations from the calculation through 'operators ^'
I hope I was clear and excuse my bad English. :)