确实很大的数字

发布于 2024-08-17 13:16:49 字数 229 浏览 2 评论 0 原文

首先,如果已经有这样的主题但我还没有找到,我深表歉意...我需要知道如何处理一个非常大的数字,例如 789^2346 的结果:

#include <iostream>
#include <cmath>
using namespace std;
int main () {
    cout << pow(789,2346) << endl;
}

First of all apologies if there is already a topic like this but I have not found... I need to know how to handle a really big number such as the result of 789^2346:

#include <iostream>
#include <cmath>
using namespace std;
int main () {
    cout << pow(789,2346) << endl;
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

爱*していゐ 2024-08-24 13:16:49

您可以尝试 GNU MP Bignum Libraryttmath。此链接指向一些示例。它非常容易使用。

You could try the GNU MP Bignum Library or ttmath. This link point to some samples. It is very easy to use.

空名 2024-08-24 13:16:49

你需要一个“大数字”库。一个流行的选择是 GNU 的多精度算术库,它具有 C 接口。我也来了一段时间了。另一个针对 C++ 的库是 大整数库

我确信某处有一个 bignum 库列表,但我找不到它。您可以浏览一个标签

You need a "big number" library. A popular choice is GNU's Multiple Precision Arithmetic Library, which has a C interface. I's also been around for a while. Another one, for C++, is Big Integer Library.

I'm sure there is a list of bignum libraries on SO somewhere, but I cannot find it. There is a tag you could stroll through.

合久必婚 2024-08-24 13:16:49

您可以考虑 C++ 的 NTL(数论库) - http://www.shoup.net/ntl/< /a> .它非常容易使用。

如果你可以放宽 C++ 的要求,Perl 和 Python 本身就支持大整数。 PHP 通过 bcmath 或 gmp 扩展支持。

You can consider NTL (Number Theory Library) for C++ - http://www.shoup.net/ntl/ . It's very easy to use.

If you can relax C++ requirement, Perl and Python support big integers natively. PHP supports via bcmath or gmp extensions.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文