Boost logo

Boost Users :

From: John Maddock (jz.maddock_at_[hidden])
Date: 2019-11-05 08:35:10


On 05/11/2019 07:47, Andy via Boost-users wrote:
> cpp_int is more convenient but mpz_int is faster especially for long
> numbers?

Probably quite a slower for small numbers, and a lot faster for large ones.

> What say benchmarks?

Out of date, but these may give some clue:
https://www.boost.org/doc/libs/1_71_0/libs/multiprecision/doc/html/boost_multiprecision/perf/int_real_world.html

> For mpz_int I must install GMP on Linux or build MPIR on WIndows
> (build lib_mpir_core2) ?
Yes.
> I want make sample benchmark test but I can't convert cpp_it to
> mpz_int nor iport bits, whereas for cpp_int I can import_bits(x,
> xBytes.begin(), xBytes.end()) where vector<uint8_t> xBytes;
> Question: is possible import byte array to mpz_int?

No, but the 2 types are explicitly convertible to each other, ie this works:

 Â Â  cpp_int i(2);
 Â Â  mpz_int j(i);
 Â Â  i = cpp_int(j);

John.

-- 
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net