Help needed with VERY large numbers.
I am trying to write a program that does integer math on extremely large numbers.
Basically, I'm going to be multiplying two numbers in the range of 250 (decimal) digits together, and comparing the results to a much larger number (say 500 decimal digits). Based on the results of the comparison, one of the two initial numbers will be modified.
My question is, how would I set these extremely long numbers as variables? I know that a 1560bit number will not fit into a "long long". Anyone know of any libraries or anything that might help me with this?
This was discussed recently...
So, search the board. (I didn't follow the discussion, so I don't know the details.)
There are libraries. You'd have to search the net.
You could write your own, if you want to do it as a learning exercise... imagine that you are using one of those mechanical counters to count the number of people entering a stadium. If the counter only goes up to 999, what do you do? Get two of them and use the second one to count how many times the first one rolls-over. (Your mathmatical operations require a bit more thinking.)
I see Salem beat me to it... with a better, more specific answer! ... I was afraid you were going to get a rude "Search the freekin' board" answer. :)
BTW - I would not attempt to write my own BigInt library, unless I really wanted to. It could turn-out to be a bigger project, than the program that utilizes the library! It's almost always better to use a pre-existing library. (Of course, sometimes cost is a consideration too.)