最好的bignum库解决C ++中的Project Euler问题?

时间:2023-01-27 17:03:01

I am still a student, and I find project Euler very fun.

我还是学生,我觉得Euler项目非常有趣。

sometimes the question requires calculations that are bigger than primitive types. I know you can implement it but I am too lazy to do this,

有时问题需要比原始类型更大的计算。我知道你可以实现它,但我懒得这样做,

So I tried few libraries,

所以我尝试了很少的库,

MAPM :: very good performance, but it provides only big floats, with the possibility to check if it is an integer. very good to accept input, but nasty to provide output, and compiles like magic with Visual C++ 2008 express.

MAPM ::性能非常好,但它只提供大浮点数,可以检查它是否为整数。非常好接受输入,但讨厌提供输出,并编译像魔术与Visual C ++ 2008快递。

bigint :: a small one, but needs a re engineering in many parts. Very simple to use, but very limited power, and very slow compared to others. only big integers.

bigint ::一个小的,但需要在很多部分重新设计。使用非常简单,但功率非常有限,与其他产品相比非常慢。只有大整数。

ttmath :: the most beautiful one I have tried until now!, just some files to include and you have unbelievable power/simplicity. Compiles like magic in Visual C++ 2008 express. It is fast, because it provides fixed-length numbers. It is built using Metaprogramming in C++. The only disadvantage I see, is that numbers are not arbitrary in length at run-time, but you can have 1024K numbers when writing code very easily,

ttmath ::我迄今为止尝试过的最漂亮的一个!,只包含一些文件,你拥有令人难以置信的力量/简洁性。在Visual C ++ 2008 Express中编译像魔术一样。它很快,因为它提供固定长度的数字。它是在C ++中使用元编程构建的。我看到的唯一缺点是数字在运行时的长度并不是任意的,但是在编写代码时可以非常容易地获得1024K数字,

ttmath::UInt<1024 * 1024> reallyHugeUnsignedInteger;

It provides three types: signed, unsigned and float.

它提供三种类型:signed,unsigned和float。

I tried to compile gmp under VC2008 express, but I failed! I know it is the best, but no where easy to compile for a beginner under VC2008 express, I appreciate also if you point to a tutorial to compile gmp under VC.

我试着在VC2008 express下编译gmp,但是我失败了!我知道它是最好的,但是在VC2008 express下很容易为初学者编译,如果你指向一个在VC下编译gmp的教程,我也很感激。

EDIT :: If you know how to compile gmp using VC 2008, Please explain to me and get the bounty :)

编辑::如果您知道如何使用VC 2008编译gmp,请向我解释并获得赏金:)

EITD :: It seems that I was not using the right terms, So here is the magical GMP for Windows! works with VC 2008 :) MPIR

EITD ::似乎我没有使用正确的术语,所以这里是Windows的神奇GMP!适用于VC 2008 :) MPIR

3 个解决方案

#1


5  

Here are a couple of links regarding GMP and Visual Studio 2008:

以下是有关GMP和Visual Studio 2008的几个链接:

GMP Install Help at CodeGuru

CodeGuru上的GMP安装帮助

GMP Compile Guide at The Edge Of Nowhere (this one looks really thorough)

The Edge Of Nowhere的GMP编译指南(这个看起来非常彻底)

#2


4  

... or just try out PARI/GP http://pari.math.u-bordeaux.fr/

...或者只是试试PARI / GP http://pari.math.u-bordeaux.fr/

#3


1  

GMP. Simple API, been around forever.

GMP。简单的API,永远存在。

Edit: Oh, you tried that. I'd really try it again, it is the best.

编辑:哦,你试过了。我真的会再试一次,这是最棒的。

#1


5  

Here are a couple of links regarding GMP and Visual Studio 2008:

以下是有关GMP和Visual Studio 2008的几个链接:

GMP Install Help at CodeGuru

CodeGuru上的GMP安装帮助

GMP Compile Guide at The Edge Of Nowhere (this one looks really thorough)

The Edge Of Nowhere的GMP编译指南(这个看起来非常彻底)

#2


4  

... or just try out PARI/GP http://pari.math.u-bordeaux.fr/

...或者只是试试PARI / GP http://pari.math.u-bordeaux.fr/

#3


1  

GMP. Simple API, been around forever.

GMP。简单的API,永远存在。

Edit: Oh, you tried that. I'd really try it again, it is the best.

编辑:哦,你试过了。我真的会再试一次,这是最棒的。