Hello all ,
Is there an algorithm for computing Very large numbers (Max 9^1000000) without BigNum ???
Thanks in advanced.
Hello all ,
Is there an algorithm for computing Very large numbers (Max 9^1000000) without BigNum ???
Thanks in advanced.
Yes.
LooL That was very helpful.
unsigned long long power(int x,int y)
{
if(y==0)return 1;
unsigned long long psum = 1;
while (y)
{
if (y & 1)
psum *= x;
y >>= 1;
x *= x;
}
return psum;
}
Now the problem is storing the result for something like 9^1000000 , it won't fit in an unsigned long long type , That's my question , Must i Implement BigNum ??
No; you don't need to implement BigNum. You can use someone else's implementation instead.