Reputation: 46533
#include <iostream>
#include <limits>
int main(void) {
cout << std::numeric_limits<uint64_t>::max();
return 0;
}
The code above outputs (on my machine) 18446744073709551615
, but I'm trying to multiply numbers that have at least 25 digits. How to properly handle a multiplication of 2 integers that are larger than uint64
?
Upvotes: 1
Views: 1315
Reputation: 75697
You need to use a library that handles big numbers. Here are some of them:
The GNU Multiple Precision Arithmetic Library
C++ Big Integer Library
Boost.Multiprecision
http://www.boost.org/doc/libs/1_55_0/libs/multiprecision/doc/html/index.html
Upvotes: 3