A question about mpz_out_str and mpz_out_raw output limitation

Nikitin Kirill kirill.nikitin at epfl.ch
Tue Jun 24 14:56:15 UTC 2014


Dear Torbjörn,

Yes, I have read about 2^37 bits limitation (which is 16 Gbytes) and it is completely fine, I do not need larger numbers. But the problem with mpz_out_raw occurs when numbers are bigger than 2^34 bits = 2^31 bytes = 2 Gbytes which is not enough for my calculations. So the numbers are stored in mpz structure without problems. Troubles occur when printing (actually gmp_fprintf also has it).

Best regards,
Kirill
________________________________________
From: tg at gmplib.org [tg at gmplib.org]
Sent: 24 June 2014 12:53
To: Nikitin Kirill
Cc: gmp-discuss at gmplib.org
Subject: Re: A question about mpz_out_str and mpz_out_raw output limitation

Nikitin Kirill <kirill.nikitin at epfl.ch> writes:

  I'm currently working with large sets of public-key moduli using
  gmp-6.0.0 for arbitrary precision arithmetic. There is a need to
  multiple all unique primes from moduli together so final number is
  getting huge sometimes (the sets sometimes include about 10 000 000
  moduli).

  I have encountered a problem that mpz_out_raw has a limitation for
  printing numbers to a file, precisely 2^31 bytes (mpz_inp_raw has the
  same accordingly). When numbers are bigger, the output is wrong (maybe
  shrunken). Therefore, I'm wondering if it is possible to remove this
  limitation in some way? and whether mpz_out_str (mpz_inp_str) has the
  same limitation?

The mpz functions will not work for numbers that have more than 2^37
bits (assuming the host uses 64-bit pointers and limbs).


Torbjörn
Please encrypt, key id 0xC8601622


More information about the gmp-discuss mailing list