For some reason the other day I thought it would be fun to write a program which took two strings and returned the results of various maths operations. So far I've managed to do Adding and Multiplication. The first is quite simple, it just uses normal add and carry which you learn in your first arithmitic lessons at school. The multiplication function uses the method of long multiplication which most of us also learnt at school. I was just wondering if these were the most efficient techiniques taking into account that the numbers could have hundreds of digits.

I thought to multiply one number by another I could just add one number to itself a certain number of times. However this would mean I'd have to make quite a few additions if I wanted to say multiply 4 billion by 3 billion. Long multiplication works better but it still doesn't seem that efficient. Anyone know of a better way?

PS I've still yet to tackle subtraction and division, they seem a lot harder to implement. And if anyone wants to see my code (can add and multiply numbers with up to 2 billion digits (although that would take forever!) I'll try to post it some other time. I don't have access to my home computer from here and I don't have the net at home )