开发者

Class for calculating arbitrarily large numbers?

开发者 https://www.devze.com 2023-02-09 06:11 出处:网络
I was wondering if there might not be a class that would allow as much accuracy a开发者_开发百科s there is memory. With overloaded operators in order to do arithmetic on it as if it was a normal numbe

I was wondering if there might not be a class that would allow as much accuracy a开发者_开发百科s 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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消