The problem with the write integer part of mpf_t really big numbers to the file

Torbjörn Granlund tg at
Mon Aug 25 10:46:34 UTC 2014

"lswierczewski ." <luk.swierczewski at> writes:

  I don't know how to save to file a floating-point number (mpf_t). I know
  that I can use function:
  This method have two important restrictions:
  1. Scientific notation (I need to use additional conversion)

I assume you mean that the parts required for scientific notation are
returned separately, requiring trivial printf "conversion".

  2. Saved value have restricted precision (as I remember there is above 2000
I cannot make any meaning from this statement.  Surely any saved value
has restricted precision.  Where does the number 2000 come from?

  As the first point isn't really a problem for me that second disqualify
  this method for various reasons. I'm working on really big numbers (up to
  even 10^(100 000 000 000)) and I need save only integer part of total value.
What does "I need save only integer part of total value" mean?
If you are working on integers, please use mpz.

  There can be used:
     gmp_fprintf(fp, "%.0Ff", result);
  but this function doesn't save correctly values above (about) 10^(50 000
  000) - in my case saves only zero (0).

Again, I cannot guess what you mean, and again your use of the verb
"save" confuses me.

  Even if this is a bug in my version of GMP this function will not be
  usefully because it can save only 2^31-1 characters (it sends back int
  type - 4 bytes of number of saved characters) This gives me maximal
  value which can be saved equals 2 147 483 647 digits - which value is
  far to low and unaccepted for me.
Hopefully GMP can be saved.  :-)

Please send concrete examples which we can compile and execute, and
don't forget to include the information we ask for in bug reports
(unambiguously stated the manual).

Please encrypt, key id 0xC8601622

More information about the gmp-discuss mailing list