Age | Commit message (Collapse) | Author |
|
Signed-off-by: Olivier Gayot <og@satcom1.com>
|
|
Signed-off-by: Olivier Gayot <og@satcom1.com>
|
|
Signed-off-by: Olivier Gayot <og@satcom1.com>
|
|
Signed-off-by: Olivier Gayot <og@satcom1.com>
|
|
Signed-off-by: Olivier Gayot <og@satcom1.com>
|
|
Signed-off-by: Olivier Gayot <og@satcom1.com>
|
|
We can now check if a number evaluates to false or true by doing a
conversion to bool or use the ! operator.
Signed-off-by: Olivier Gayot <og@satcom1.com>
|
|
Long multiplication is the multiplication algorithm that is being taught
to children in grade school.
Although it is very slow compared to Karatsuba algorithm, it is still
much faster than the dumb algorithm previously used.
Signed-off-by: Olivier Gayot <og@satcom1.com>
|
|
Signed-off-by: Olivier Gayot <og@satcom1.com>
|
|
Signed-off-by: Olivier Gayot <og@satcom1.com>
|
|
When two numbers (i.e. their _operands list) had different sizes, their
addition was resulting in undefined behaviour because, at some point in
the computation, we were dereferencing the iterator of the shortest
number (and the iterator was _operands.cend()).
Fixed by virtually "padding" the shortest number with zeros.
Signed-off-by: Olivier Gayot <og@satcom1.com>
|
|
The method to_uint32() converts a number to a 32-bits-wide integer. The
function throws if number cannot be represented using only a single
32-bits-wide integer.
Signed-off-by: Olivier Gayot <og@satcom1.com>
|
|
We are using an easy to implemented but extremely slow algorithm to
compute the multiplication of two numbers of size n.
Signed-off-by: Olivier Gayot <og@satcom1.com>
|
|
Signed-off-by: Olivier Gayot <og@satcom1.com>
|
|
Signed-off-by: Olivier Gayot <og@satcom1.com>
|
|
This will allow multiplication to hold the result of the multiplication
of two 32 bits integer in a 64 bits integer.
Signed-off-by: Olivier Gayot <og@satcom1.com>
|
|
When a number is streamed into a ostream object, the hexadecimal
representation of the number is given to the stream.
Signed-off-by: Olivier Gayot <og@satcom1.com>
|
|
Signed-off-by: Olivier Gayot <og@satcom1.com>
|
|
We're using the grade school addition method to compute the sum of two
numbers of size n.
Signed-off-by: Olivier Gayot <og@satcom1.com>
|
|
Signed-off-by: Olivier Gayot <og@satcom1.com>
|
|
Signed-off-by: Olivier Gayot <og@satcom1.com>
|