完全便携的大号库 [英] Fully Portable Big Number Library
问题描述
我需要一个大号码库。我一直在考虑将我的
项目转换为C ++,但目前我正在探索在C中保持
的途径。
什么是C的最佳大数字库?我需要能够
代表数字(95 ^ 63),大约是(2 ^ 6.6)^ 63,
大概是2 ^ 416,所以我们说的可能是一个512位的数字。
所以我需要能够在512位
上进行除法和乘法运算。有没有人在这个特定的Big
号码库中有过很好的经历?
I need a Big Number library. I''ve been considering switching my
project to C++ but at the moment I''m exploring the avenue of keeping
it in C.
What''s the best Big Number library for C? I need to be able to
represent the number (95 ^ 63), which is approximately (2 ^ 6.6) ^ 63,
which is about 2 ^ 416, so we''re talking about maybe a 512-Bit number.
So I need to be able to do division and multiplication on a 512-Bit
number. Has anyone here had good experiences with a particular Big
Number library?
推荐答案
Tomásóhéilidhe< to * @ lavabit.com写:
Tomás ó héilidhe <to*@lavabit.comwrites:
我需要一个大数字库。我一直在考虑将我的
项目转换为C ++,但目前我正在探索在C中保持
的途径。
什么是C的最佳大数字库?我需要能够
代表数字(95 ^ 63),大约是(2 ^ 6.6)^ 63,
大概是2 ^ 416,所以我们说的可能是一个512位的数字。
所以我需要能够在512位
上进行除法和乘法运算。有没有人在这个特定的Big
号码库中有过很好的经历?
I need a Big Number library. I''ve been considering switching my
project to C++ but at the moment I''m exploring the avenue of keeping
it in C.
What''s the best Big Number library for C? I need to be able to
represent the number (95 ^ 63), which is approximately (2 ^ 6.6) ^ 63,
which is about 2 ^ 416, so we''re talking about maybe a 512-Bit number.
So I need to be able to do division and multiplication on a 512-Bit
number. Has anyone here had good experiences with a particular Big
Number library?
GMP在非常多的平台上得到支持,而且由于花费了很多精力,因此非常有效优化它。它通过传统的机制实现了它的便携性
相当彻底的平台差异化配置阶段,
和充足的使用前处理器。在所有平台上,实际编译的代码只有少量
。
我使用GMP进行我所有的''小''bignum工作(最多几千)
位数。
对于更简单的东西,并设计有明确的意图
作为bignums如何学习的经验为作者和用户实施
,还有一个名为
''libtommath'的库,我认为这是公共领域。它可能不适用于36位la-la land中的
,但似乎可以在现代的32位和64位架构中移植。 (我想我也是在16位
架构上运行它。)这可能足以满足你的需求。
Google就是你的朋友。
菲尔
-
理查德希思菲尔德 - 请不要浪费你的时间邮寄不请自来的
回应我的签名的基督徒随意。
与基督教一样,社会主义最糟糕的广告是它的b $ b b信徒。 - 埃里克亚瑟布莱尔(1903-1950),通往威根码头的道路(1937年)
GMP is supported on a very large number of platforms, and is very
efficient as it''s had a lot of effort spent optimising it. It
achieves its portability via the traditional mechanism of a
fairly thorough platform-differentiating configuration stage,
and plenty of use of the pre-processor. Only small amounts of
the code actually being compiled are identical on all platforms.
I use GMP for all my ''small'' bignum work (up to a few thousand
digits).
For something simpler, and designed with the express intention
of being a learning experience in how bignums can be implemented
for both the author and user, there''s also a library called
''libtommath'' which is I believe public domain. It might not work
in "36-bit la-la land", but seems to be portable across modern
32- and 64-bit architectures. (I think I''ve also run it on 16-bit
architectures too.) That might be good enough for your needs.
Google is your friend.
Phil
--
Richard Heathfield - please do not waste your time mailing unsolicited
Christian ramblings in response to my signatures.
As with the Christian religion, the worst advertisement for Socialism is its
adherents. -- Eric Arthur Blair (1903-1950), The Road to Wigan Pier (1937)
10月27日下午1点41分,托马斯óhéilidhe< t。 .. @ lavabit.comwrote:
On Oct 27, 1:41 pm, Tomás ó héilidhe <t...@lavabit.comwrote:
我需要一个大号码库。我一直在考虑将我的
项目转换为C ++,但目前我正在探索在C中保持
的途径。
什么是C的最佳大数字库?我需要能够
代表数字(95 ^ 63),大约是(2 ^ 6.6)^ 63,
大概是2 ^ 416,所以我们说的可能是一个512位的数字。
所以我需要能够在512位
上进行除法和乘法运算。有没有人在这个特定的Big
号码库中有过很好的经历?
I need a Big Number library. I''ve been considering switching my
project to C++ but at the moment I''m exploring the avenue of keeping
it in C.
What''s the best Big Number library for C? I need to be able to
represent the number (95 ^ 63), which is approximately (2 ^ 6.6) ^ 63,
which is about 2 ^ 416, so we''re talking about maybe a 512-Bit number.
So I need to be able to do division and multiplication on a 512-Bit
number. Has anyone here had good experiences with a particular Big
Number library?
首先,在这里寻求关于图书馆的建议是偏离主题的。
你的问题(以及我的答案)是:
First of all, asking for advice on libraries here is off-topic.
Your questions (and my answers) are:
什么是C的最佳大数字库?
What''s the best Big Number library for C?
定义最佳(你的主题建议''完全便携''=''最好'',但是
你没有提到它在你的文章正文中)
Define best (your subject suggests ''fully portable'' = ''best'', however
you don''t mention it in the body of your article)
这里有没有人对特定的Big
号码库有过良好的体验?
Has anyone here had good experiences with a particular Big
Number library?
是
Yes
vi ****** @ gmail.com 说:
10月27日下午1:41,Tomásóhéilidhe< t ... @ lavabit.comwrote:
On Oct 27, 1:41 pm, Tomás ó héilidhe <t...@lavabit.comwrote:
>我需要一个大号码库。我一直在考虑将我的
项目转换为C ++,但目前我正在探索将它保存在C中的途径。
什么是最好的C的大数字库?我需要能够代表数字(95 ^ 63),大约是(2 ^ 6.6)^ 63,
大概是2 ^ 416,所以我们说的也许是512位数。
所以我需要能够在512位数上进行除法和乘法运算。有没有人在这个特定的Big
数字库中有过很好的经历?
>I need a Big Number library. I''ve been considering switching my
project to C++ but at the moment I''m exploring the avenue of keeping
it in C.
What''s the best Big Number library for C? I need to be able to
represent the number (95 ^ 63), which is approximately (2 ^ 6.6) ^ 63,
which is about 2 ^ 416, so we''re talking about maybe a 512-Bit number.
So I need to be able to do division and multiplication on a 512-Bit
number. Has anyone here had good experiences with a particular Big
Number library?
首先,在这里征求关于图书馆的建议是偏离主题的。
First of all, asking for advice on libraries here is off-topic.
为什么?在我看来,这个组的主题是C编程,
无论平台如何。库的使用肯定是编程的一部分。
好的,我能理解 - 并且同意 - 关于平台特定库的
使用的详细讨论在这里是偏离主题的,但是他要求的是一个完全便携的库。
我知道人们可能会因为帮助OP而异议的一个原因,但是
时尚性不是。
-
Richard Heathfield< http://www.cpax.org .uk>
电子邮件:-http:// www。 + rjh @
谷歌用户:< http://www.cpax.org.uk/prg/writings/googly.php>
Usenet是一个奇怪的放置" - dmr 1999年7月29日
Why? It seems to me that the topic of this group is C programming,
regardless of platform. Library usage is certainly a part of programming.
Okay, I can understand - and agree - that detailed discussions on the
usage of platform-specific libraries is off-topic here, but what he''s
asking for is a fully portable library.
I know of one reason why people might demur from helping the OP, but
topicality isn''t it.
--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
这篇关于完全便携的大号库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!