I would like to make my program calculate this:
but the answer is too big, but there must be a way to calculate this in my program...Code:cout <<(long double)pow((long double)2,2005)<<endl;
Printable View
I would like to make my program calculate this:
but the answer is too big, but there must be a way to calculate this in my program...Code:cout <<(long double)pow((long double)2,2005)<<endl;
You could consider using the GNU MP library.
tere :)
i wrote a program to deal with huge numbers a while ago. it's not hard to do this. to write a pow() just write a multiplication function and use it in a loop, it would be slow, yes, but it will get the job done.
I agree, but it can be tedious if you're working on something else and just need bignum support. Not only that, but it isnt easy to make it run (relatively) fast.Quote:
it's not hard to do this.
yes, you are right, laserlight. if he's working on something else, then it really isn't necessary, but if it's just a hobby project why not...Quote:
Originally Posted by laserlight
Displays 0:
Code:#include <cstdlib>
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
int slow=2;
for(int road=1;road<2005;road++){
slow=slow*2;
}
cout<<slow<<endl;
system("PAUSE");
return EXIT_SUCCESS;
}