A question about mpz_out_str and mpz_out_raw output limitation

Torbjörn Granlund tg at gmplib.org
Tue Jun 24 19:07:36 UTC 2014


David Gillies <daggillies at gmail.com> writes:

  From the manual entry for mpz_out_raw(): "The integer is written in a
  portable format, with 4 bytes of size information, and that many bytes of
  limbs." So that would seem to limit it to 2^35 bits.
  
The mpz_inp_raw/mpz_out_raw format is not something I am proud of.  It's
probably a better idea to use mpz_import/mz_export, first writing the
size on some more scalable format.

Note that the limit for the 'raw' functions is 2^34 bits.  Since it needs
to cope with negative numbers it is not 2^35..

The other I/O functions should work for the full mpz range.  If they do
not, that's a bug.


Torbjörn
Please encrypt, key id 0xC8601622


More information about the gmp-discuss mailing list