On 27/05/2023 19:15, Matthew Mawson via Boost-users wrote:
I want to assign a large number to a cpp_int variable like this:

cpp_int large = 
30414093201713378043612608166064768844377641568960512000000000000;

and I get this: error: integer literal is too large to be represented in any 
integer type.

You're compiler is correct, there are two ways around this, the first is assignment from a string, which must be an explicit cast or construction:

cpp_int large{"30414093201713378043612608166064768844377641568960512000000000000"};

Or you can create extended precision literals, but these must be in hex format, see https://www.boost.org/doc/libs/1_82_0/libs/multiprecision/doc/html/boost_multiprecision/tut/lits.html

John.

_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
https://lists.boost.org/mailman/listinfo.cgi/boost-users

Reply via email to