Cornflake wrote:
Why use Java when you can use something good?
Besides this is actually a good exercise for figuring out the algorythms behind something, instead of just using a peice of lirabry code. Understanding how something works is a good thing, much better then just taking for granted then it does.
first of all, java's implementation of BigInteger is much more efficient than possible anyone here can come up with (including myself).
for example, one optimization is to use base 2^32. So a large number is represented with a few digits (as opposed to 1000). while you are doing 1000 operations, I am doing 10. hola! i dont care how fast C++ is, its not 100 times faster than java.
and secondly if you know it well enough, you can code it up in 2 minutes, instead of writing ur own addition routine, which takes at least 5 minutes to get it correct (atually its not THAT bad, but when it comes to multiplication, division, its get worse).