gmp 4.2.4 - mpf_add two large negative floats - strange result

Torbjorn Granlund tg at
Thu Jan 22 14:31:34 CET 2009

Vincent Lefevre <vincent at> writes:

  On 2009-01-22 08:49:32 +0100, Paul Zimmermann wrote:
  > right for mpfr. For gmp, the "precision" depends on the value you store. More
  > precisely, gmp mpf_t's are stored in base 2^32 or 2^64, with at least 64
  > significant bits. This implies at least 3 words on a 32-bit computer, and
  > 2 words on a 64-bit computer. Thus the "real" precision you get when you
  > request 53 bits can go from 65 bits for a number like on a 32-bit
  > computer, to 128 bits for a number like 0.999xxx on a 64-bit computer.
  Yes, and in MPFR, all numbers are normalized, meaning that the
  "real" precision is always equal to the declared precision. On
  the accuracy side, MPFR provides correct rounding to the declared
  precision, while in GMP, the accuracy is unspecified, AFAIK.

While I agree that mpfr > mpf in several ways, let's not exaggerate.

The accuracy in GMP's mpf is not exactly "unspecified".  It is specified
to be something at least what the user asked for.  Rounding is somewhat
rough, in that results are always rounded towards 0.


More information about the gmp-discuss mailing list