我正在寻找 MSVC++ 特定的任意精度库。由于我的工作不需要跨平台兼容性,因此我不想让这一切变得混乱。
我尝试查看 NTL 但看到类似“这些步骤适用于 MSVC++ v6" 我情不自禁地在心里将其埋葬,因为它已经过时了。最新版本:2009 08 14
。
MPIR 看起来很有前途(最新版本 2011 06 14
),这是我迄今为止发现的最好的东西。
对于从 MSVC++(本机代码,而不是 .NET)执行至少 128 位浮点运算有什么建议吗?
I'm looking for an MSVC++ specific arbitrary precision library. Since I don't need cross platform compatibility for what I'm working, I'd rather not have the mess of it all.
I tried looking at NTL but upon seeing statements like "These steps work with MSVC++ v6" I can't help but mentally bury it as out of date. Latest build: 2009 08 14
.
MPIR looks promising (latest build 2011 06 14
), its the best thing I found so far.
Any suggestions for doing at least 128-bit floating point arithmetic from MSVC++ (native code, not .NET)?
发布评论
评论(2)
MPIR 是目前最好的 C++ 多精度(任意精度)算术库。事实上它是跨平台的,这是一个优点。在 MSVC++ 2010 上编译很容易,您只需确保打开 README.TXT(随下载一起提供)并阅读 文档,(悄悄地列为列表中的第三个下载,但实际上相当不错)。
它基于 GMP 并取代 NTL,应该被放弃,因为它没有得到维护。
MPIR 拥有大量CPU 的构建和汇编代码,其中包括大量 Intel 和 AMD 芯片。
我在构建过程中(在两台独立的机器上!)遇到的一个问题是 CPU 类型未正确识别。在一台机器上,我有一个“k102”处理器(可以被视为“k10”),在另一台机器上,我有“westmere”(可以被视为“nehalem”)。无论如何,修复方法是BROWSE CONFIGURATION.BAT并查找您的CPU类型。当您调用“configure.bat”时,请使用如下行:
如果您知道您有 AMD k10 兼容 CPU。 AMD 1090T 处理器就发生过这种情况。
MPIR is the best C++ multi-precision (arbitrary precision) arithmetic library available right now. The fact that it is cross-platform is a plus. It is easy to compile on MSVC++ 2010, you just have to make sure to open README.TXT (that comes with the download) and also read the Documentation, (which is quietly listed as the 3rd download in the list but is actually quite good).
It is based on GMP and supercedes NTL, which should be all but abandoned because its not being maintained.
MPIR has builds and assembly code for a large number of CPUs, including like a ton of Intel and AMD chips.
One hitch I encountered in the build process (on 2 separate machines!) was the CPU type was not identified correctly. On one machine I had a "k102" processor (which can be considered "k10") and on another machine I had "westmere" (which could be considered as "nehalem"). Anyway the fix is BROWSE CONFIGURATION.BAT and look for your CPU type. When you invoke "configure.bat", use a line like:
If you know you have an AMD k10 compatible CPU. This happened with a AMD 1090T processor.
MPIR 可以使用 Visual Studio 2017 进行编译。Brian
Gladman 维护着 MPIR 的一个分支,可以与 Visual Studio 很好地构建:
https://github.com/BrianGladman/mpir
另外尝试运行
gen_*.bat如果这不起作用,请在同一目录中删除
文件。它还需要 Windows SDK。
Brian 还维护着一个在 Visual Studio 下构建的 MPFR 分支:
https://github.com/BrianGladman/mpfr
Boost 还包括 MPFR 和 GMP 多用途的 C++ 绑定精密库。 Boost 维护良好,并且在任何版本的 Visual Studio 中都可以顺利编译。
MPIR can be compiled with Visual Studio 2017.
Brian Gladman maintains a fork of MPIR that builds nicely with Visual Studio:
https://github.com/BrianGladman/mpir
Also try running the
gen_*.bat
files in that same directory if this does not work.It will also need a Windows SDK.
Brian also maintains a fork of MPFR that builds under Visual Studio:
https://github.com/BrianGladman/mpfr
Boost also includes C++ bindings for MPFR and GMP multi-precision libraries. Boost is well-maintained and will compile without much trouble within any version of Visual Studio.