I was solving a problem where I need to multiply two numbers of order 10^18. So I wanted to know whether there is any way in C++ to handle a number of order 10^37.
If you are calculating that multiplication under some modular value less than 10^18 then two solutions.
- create a function for multiplying two numbers and use __int128 only in that function and return a long long int value from that function (super fast) because __int128 is solwer.
2)use “long long int” with “mulmod”(multiplication under modulo) for multiplying two numbers.(not so fast but faster than using __int128 everywhere i.e faster if you don’t follow 1st point)