Is there a generally accepted alternative to GMP f

2019-06-17 02:36发布

问题:

In my quest for looking for a BigInt library, I came across this post: C or C++ BigInt library on Microsoft Windows

The accepted answer mentions the GMP library, but one of the commenters claim that library does not error out very gracefully and would not be good for production code. Has anybody done any long term development with this library? Are there any good alternatives? Thanks in advance.

回答1:

Well, as a large project like GCC uses this for it's printf and compile-time calculations (correct me if I'm wrong here), I think it's stable enough. I would think there are ways to limit the out-of-memory errors the commenter worries about, but I haven't used it personally, so I can't help you there. All I'm saying is that it is a proven stable library. It even has a C++ interface library.



回答2:

The implementation of the Tcl language uses libtommath for its bigint library, and it does indeed appear to be suitable for production use. (It's a C library, not C++, but it's certainly suitable.)



标签: c++ bigint