Is there any particular solution for handling operations with, let's say, 50 digit numbers or more, without the help of third-party libraries?
Printable View
Is there any particular solution for handling operations with, let's say, 50 digit numbers or more, without the help of third-party libraries?
Any tips on doing that? I came up with a solution that may not work or may not be efficient, basically store the number in a char array and then convert each element of the array to a integer and pass them to a integer array and start doing the operations and work from there....
Do you know how to do + - * / on paper?
If you know that, then sure it's very easy.Code:12
+34
=46
It might not be particularly quick, but it will work.
If you want efficiency, without using an existing library, then expect lots of hard work and research.
I didn't want to use any third-party library for such a thing myself either, so I wrote my own, well two of them actually.
They store the data as binary, one dynamically allocated, the other not.
I'm considering writing another one that stores it as a string, also.
Do you really want to know how to make your own? If so, you make a start, and we'll point you at a few resources on how to do the bits you aren't sure of.