0

I have a number (num1) which is 18 digits long. I am storing it in an integer array. I have another number (num2) which is also 18 digits long. This is also being stored in an integer array.

I have to find the log of the first number to the base of the second number (log num1 to base num2).

How to do this in C++? I can't use the log function as the numbers are being stored in arrays.

Jonathan Hall
  • 75,165
  • 16
  • 143
  • 189
Zer0
  • 2,171
  • 3
  • 17
  • 18

1 Answers1

2

They key term to google for is bigint. There are various C++ libraries which support bigints (that is, number which can be as long as your memory permits).

The only bigint library I've used myself is GMP. However, if you just need a single function on bigints (log, in your case), then maybe taking some smaller library (is more practical).

Just checked the GMP page and incidentally, it calls them bignums all over. So that may be another useful term to use when searching for a solution. ;-)

Frerich Raabe
  • 90,689
  • 19
  • 115
  • 207