So basically I'm working on a project involving some algebraic expressions involving very large numbers. And using the standard operators (int, long int, long long and so on) just doesn't cut it. The code I'm currently using is written as (and is part of a larger project):
#include<iostream>
long int myPow(long int base, long int exponent, long int mod) {
long int prod = 1;
while (exponent > 0) {
if (exponent & 1 == 1) {
prod *= base;
prod %= mod;
}
base *= base;
base %= mod;
exponent /= 2;
}
return prod;
}
int main () {
long int a = myPow(2 , 1000, 100007);
std::cout << a << std::endl;
system("pause");
return 0;
}
Now, I have read that it is possible to use GMP for handling very large numbers. Unfortunately, I'm rather new to the programming world. And as fare as I understand, GMP relies on the MinGW compiler. I'm currently running Visual Studio 2015.
I have browsed through different forums and Google, but I haven't been able to find any new guides (after 2014) on how to setup GMP (and/with MinGW), which means links are broken, references non-existing, etc. I'm also freakishly afraid to start tampering with Windows/Visual Studio (trying to "install" (?) MinGW), as I don't want to lose my current working setup/compiler (standard Visual Studio compiler - no clue what it's called).
Anyway, if someone could point me in the right direction or recommend some literature, it would be greatly appreciated.
As a last resort, I'm considering installing Code::Blocks (standard MinGW?!), but I'm afraid it will mess up my current setup for Visual Studio? Another possibility would be to create a Virtual Machine with Ubuntu and run Code::Blocks on it. Anyway, it seem rather extensive and I would prefer to stay in Windows with VS - if possible.