C 或 C++ 中的大整数

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4827538/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-28 16:40:32  来源:igfitidea点击:

Big integer in C or C++

c++cbigint

提问by user507401

I was working on a factorial program, and the program didn't work when trying to find the factorial of 1000. I think big integers are the solution; how do they work? (In either C or C++)

我正在研究一个阶乘程序,当试图找到 1000 的阶乘时该程序不起作用。我认为大整数是解决方案;它们是如何工作的?(在 C 或 C++ 中)

回答by Flexo

GMPcan do bigintoperations for both C and C++. The documentation on that site is a good introduction, if you use the C++ classes they behave almost exactly like built-in primitive types.

GMP可以bigint对 C 和 C++进行操作。该站点上的文档是一个很好的介绍,如果您使用 C++ 类,它们的行为几乎与内置原始类型完全相同。

回答by Leonidas

Look for the GMP. See the other question regarding this topic:

寻找 GMP。请参阅有关此主题的其他问题: