I am using the GCC built-in type __int128
for a few things in my C++ program, nothing really significant, at least not enough to justify to use BigInt library o
The stock cout
does not handle __int128
, but you may extends it with your own function.
For starter, code something like this:
std::ostream& operator<<(std::ostream& os, __int128 t) {
// TODO: Convert t to string
return os << str;
}
There are many solution on SO to convert 128 bit number to string, I'll not repeat here.
About library compatibility in comment:
You only need to roll your own function if the standard library does not provide such handler. Once the library support the type, you should then see a conflict when building, something like [ note: built-in candidate operator<< ], go try that with int64_t.