jmasterx
jmasterx

Reputation: 54143

Class for calculating arbitrarily large numbers?

I was wondering if there might not be a class that would allow as much accuracy as there is memory. With overloaded operators in order to do arithmetic on it as if it was a normal number.

Ex:

BigNumber num;

num = 8;
for(int i = 0; i < 5000000; ++i)
{
   num *= num;
}

Thanks

Upvotes: 1

Views: 3815

Answers (1)

peoro
peoro

Reputation: 26060

There are plenty libraries for that, like GMP (it provides also a C++ interface) or cbignum.

You'll probably find as many libraries of this kind as you wish.

Upvotes: 6

Related Questions