I've tried using
long long int
But it wont work for numbers like 3141592653589793238462643383279502884197169399375, I need this up to 10 ^ 80. Any idea? Let me know. Thanks alot.
The big integer data type ( bigint ) is used to represent whole numbers that are outside the range of the integer data type and can be stored within 64 bits.
A BigInt value, also sometimes just called a BigInt, is a bigint primitive, created by appending n to the end of an integer literal, or by calling the BigInt() function (without the new operator) and giving it an integer value or string value.
The INTEGER data type stores whole numbers that range from -2,147,483,647 to 2,147,483,647 for 9 or 10 digits of precision. The number 2,147,483,648 is a reserved value and cannot be used.
You can't use any built-in integer type for this. You need a "multiple precision integer" aka "bignum" library. For C++, I would try Boost.Multiprecision first, but be aware that Boost can be considerably more trouble than it is worth, particularly if the module you're using has any shared library (aka DLL) component. The other obvious choice is GNU MP. It only has a C interface, but it is well-maintained, reliable, fast, and very popular (in fact, it appears that Boost.MP is "just" a C++ wrapper for it!)
WARNING: You might want a bignum library because you are trying to implement one of the cryptographic primitives that uses huge numbers, like RSA. Do not do this. The generic bignum libraries are not safe for cryptographic use, and even if they were, there would still be dozens of subtle mistakes you can make that would ruin your security. Use a well-tested cryptography library instead; for C++ I recommend Botan.
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