I think i don't get something.
Is the class cpp_int
from boost::multiprecision
supposed to hold integers as big as one want ?
Let's say i want to store the following ridiculously big integer. How am I supposed to do it ?
#include <boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision;
cpp_int n = 999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999;
The following code returns
error: integer literal is too large to be represented in any integer type
As detailed in the documentation, you need to construct with a string:
cpp_int n{"999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999"};
See https://www.boost.org/doc/libs/1_74_0/libs/multiprecision/doc/html/boost_multiprecision/tut/conversions.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With