My program needs to use exponents, however, double does not allot enough space for my numbers, is there another way to use the pow(x,y) function or is there another function for exponents that I'm overlooking?
#include <iostream>
#include <cmath>
using namespace std;
int main(void)
{
int thresh = 10000;
long long sum = 0;
for(long double n = 2; n <= thresh; n++)
{
long double t1 = ((3*(pow(2,n)))-1);
long double t2 = ((3*(pow(2,(n-1))))-1);
long double t3 = ((9*(pow(2,((2*n)-1))))-1);
long double n1 = (pow(2,n)*t1*t2);
long double n2 = (pow(2,n)*t3);
sum += n1;
sum += n2;
}
cout << sum << endl;
cin.get();
return 0;
}