Hello all ,
Is there an algorithm for computing Very large numbers (Max 9^1000000) without BigNum ???
Thanks in advanced.

Recommended Answers

All 4 Replies

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.