I need some help with algorithms in my BigNum class (integers only). Currently, I have a fully functional BigNum class. However, multiplication and division are done by using the long division/multiplication taught to children in elementary school. I am looking for a better algorithm that is more efficient. The same is true of my pow function. It only accepts BigNum arguments and loops using *=. Again, this is inefficient with large exponents. Any suggestions in either case would be greatly appreciated.
Here's a little more info on the class:
- the sign is stored in a bool w/true representing negative
- the abs of the function is stored in a string
- I defined the the 4 basic operators to call the Add, Multiply, Subtract, and Divide functions passing the two values and the sign of the resulting value.