如何在C ++中添加非常大的数字? [重复]

时间:2022-07-19 16:50:06

How can I add very large numbers in C++?

如何在C ++中添加非常大的数字?

6 个解决方案

#1


3  

consider a "bignum" library like: http://gmplib.org/ or http://ttmath.slimaczek.pl/ttmath. take a look at a simple bignum class: http://www.circlemud.org/~jelson/560/

考虑一个“bignum”库,如:http://gmplib.org/或http://ttmath.slimaczek.pl/ttmath。看看一个简单的bignum类:http://www.circlemud.org/~jelson/560/

#2


1  

Do a Google on "Bigint C++" This will provide you with a list of arbitrator precision integer arithmetic libraries.

在“Bigint C ++”上做Google这将为您提供仲裁器精度整数算术库的列表。

#3


0  

You can find a big decimal implementation at http://speleotrove.com/decimal/

你可以在http://speleotrove.com/decimal/找到一个大的十进制实现

#4


0  

How big is "very large"? A signed long int can go up to 2,147,483,647 and an unsigned long int can go up to 4,294,967,295.

“非常大”有多大?有符号的long int最高可达2,147,483,647,无符号long int最高可达4,294,967,295。

#5


0  

GMP has a GMPXX C++ wrapper which is kind of nice. GMP supports both integer and floating point numbers, and is LGPL'ed.

GMP有一个GMPXX C ++包装器很好看。 GMP支持整数和浮点数,并且是LGPL。

I've used it. It's ok, but watch out for creating lots of temporaries. (Potential efficiency hit.)

我用过它。没关系,但要注意创造很多临时工。 (潜在的效率。)

#6


-1  

You could use a library like LiDIA for a 'big integer' class.

你可以像LiDIA这样的库使用'大整数'类。

#1


3  

consider a "bignum" library like: http://gmplib.org/ or http://ttmath.slimaczek.pl/ttmath. take a look at a simple bignum class: http://www.circlemud.org/~jelson/560/

考虑一个“bignum”库,如:http://gmplib.org/或http://ttmath.slimaczek.pl/ttmath。看看一个简单的bignum类:http://www.circlemud.org/~jelson/560/

#2


1  

Do a Google on "Bigint C++" This will provide you with a list of arbitrator precision integer arithmetic libraries.

在“Bigint C ++”上做Google这将为您提供仲裁器精度整数算术库的列表。

#3


0  

You can find a big decimal implementation at http://speleotrove.com/decimal/

你可以在http://speleotrove.com/decimal/找到一个大的十进制实现

#4


0  

How big is "very large"? A signed long int can go up to 2,147,483,647 and an unsigned long int can go up to 4,294,967,295.

“非常大”有多大?有符号的long int最高可达2,147,483,647,无符号long int最高可达4,294,967,295。

#5


0  

GMP has a GMPXX C++ wrapper which is kind of nice. GMP supports both integer and floating point numbers, and is LGPL'ed.

GMP有一个GMPXX C ++包装器很好看。 GMP支持整数和浮点数,并且是LGPL。

I've used it. It's ok, but watch out for creating lots of temporaries. (Potential efficiency hit.)

我用过它。没关系,但要注意创造很多临时工。 (潜在的效率。)

#6


-1  

You could use a library like LiDIA for a 'big integer' class.

你可以像LiDIA这样的库使用'大整数'类。