Which C++ type is large enough to represent a 64 digit decimal number like
3141592653589793238462643383279502884197169399375105820974944592 ?
Which C++ type is large enough to represent a 64 digit decimal number like
3141592653589793238462643383279502884197169399375105820974944592 ?
There's nothing "out of the box" for this: you'd need a 64 * log(10) / log(2) bit integral type. (A std::int256_t
from the future would suffice!)
If you're not going to manipulate the number mathematically in any way, then use a std::string
.
Otherwise, consider using the large number library in Boost: www.boost.org. That stuff has a habit of making it into future C++ standards. Note that
#include <boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision;
yields the int256_t
type.