0

For example, how can I use the result of 1000^1000 for arithmetic? I don't think there's a library that can accommodate that, all I see at most is 100 number digits.

Seb
  • 1,966
  • 2
  • 17
  • 32
  • 1
    1000^1000 only has one significant digit, so that's probably not that big a deal. Have you looked into [GMP](http://gmplib.org)? – Carl Norum Mar 21 '13 at 21:06
  • 1
    boost arbitrary arithmetic has no limits as far as I know. Why do you need such large ints? – DiegoNolan Mar 21 '13 at 21:07
  • See the answer to this question: http://stackoverflow.com/questions/1055661/bigint-bigbit-library – bithead61 Mar 21 '13 at 21:08
  • You may not think that there is such a library, but did you try google? The first result for "C++ extremely large integer library" points you to [Matt McCuthchen's Big Integer Library](https://mattmccutchen.net/bigint/) which also links to GMP. Did you try searching StackOverflow before posting? "Large Integer Library" yields a lot of results, all useful... – Nik Bougalis Mar 21 '13 at 22:49

2 Answers2

5

Use an arbitrary-precision arithmetic library like GMP or Boost.Multiprecision.

genpfault
  • 51,148
  • 11
  • 85
  • 139
2

What you are looking for is a library like GMP or Boost-Multiprecision or TTmath.

Or, you might challenge yourself to write a low level representation that handles longer than standard bit representations, and do arithmetic with it.

Stick with the first option though, if it does the job you have in mind.

meyumer
  • 5,063
  • 1
  • 17
  • 21