MPFR version 2.1.1 (released on 23 February 2005)

[download] [documentation] [bugs] [changes]

MPFR 2.1.1 requires GMP 4.1.0 or higher.


MPFR 2.1.1 can be downloaded in the following archive formats:

The signatures can be checked with Laurent Fousse's key (or grab this key A1696D2B from the keyserver

Note that the patches below have not been applied.

MPFR is also available as the official Debian package libmpfr-dev. Patches 1 to 6 have been applied in libmpfr-dev 2.1.1-5 (Sarge version). Patches 7 and 8 have been applied in libmpfr-dev 2.1.1-7. Patches 9, 10 and 11 have been applied in libmpfr-dev 2.1.1-9, 2.1.1-10 and 2.1.1-11 respectively.



The bugs listed below have been fixed (latest update: 2005-08-02). The following instructions are for Linux and may be similar for other operating systems. You can apply the patches in several ways:

Note: These patches are in unified diff format and some vendors' patch commands cannot deal with them; in this case, please use GNU patch (it may already be installed on your system, e.g. as /usr/local/bin/patch or gpatch).

Fixed bugs:

  1. The following patch fixes a bug in the exponential function due to a wrong approximation to x/log(2): mpfr_exp_2 patch (with testcase).
  2. The low-level addition of the form (a,b,a) is buggy when the exponent of b is equal to the exponent of a plus the precision of b; the following patch fixes that: mpfr_add1sp patch (with testcase).
  3. The mpfr_atanh function returns an infinity instead of NaN for input values x such that 1 < |x| < 2. This bug is fixed by the mpfr_atanh patch (with testcase).
  4. The mpfr_pow_ui function to evaluate xn (n being a nonnegative integer) has two bugs. First, if x = 0 and n > 0, the result 0 may have a wrong sign. The second bug occurs in some cases that are difficult to round and yields values that are not correctly rounded. These two bugs are fixed by the mpfr_pow_ui patch, which also provides a testcase for the second bug.
  5. A possible infinite loop in mpfr_get_ld with very small numbers. This bug is fixed by the mpfr_get_ld patch (with testcase).
  6. The testcase in the mpfr_get_ld patch was buggy, and there is a bug in mpfr_set_ld too, still with very small numbers. This is fixed by the mpfr_set_ld patch.
  7. The mpfr_div_ui function is buggy. It is fixed in the mpfr_div_ui patch (with testcase).
  8. An infinite loop in mpfr_hypot if one of the inputs is much larger than the other one and its precision is larger than the precision of the result. The cause is an overflow in the internal computations. This bug is fixed by the mpfr_hypot patch (with testcase).
  9. A bug was indirectly introduced in the addition when the internal format of MPFR numbers changed: overflows in the final rounding are no longer handled correctly. This bug is fixed by the mpfr_add1 patch.
  10. The mpfr_atan function on -0 returns +0 instead of -0. This bug is fixed by the mpfr_atan patch (with testcase).
  11. The mpfr_strtofr function may fail under some locales due to the use of the strncasecmp function, as shown by the following program. This program uses the Turkish locale tr_TR.ISO8859-9 where the ASCII characters I and i do not match (you need to have this locale installed on your system if you want to test this program). This bug is fixed by the parse_string patch.
    #include <stdio.h>
    #include <stdlib.h>
    #include <locale.h>
    #include <gmp.h>
    #include <mpfr.h>
    int main (void)
      mpfr_t x;
      char *endptr;
      if (setlocale (LC_CTYPE, "tr_TR.ISO8859-9") == NULL)
          fprintf (stderr, "can't set LC_CTYPE to tr_TR.ISO8859-9\n");
          exit (EXIT_FAILURE);
      mpfr_init (x);
      mpfr_strtofr (x, "INFINITY", &endptr, 8, GMP_RNDN);
      mpfr_clear (x);
      printf (*endptr == '\0' ? "OK\n" : "Failed\n");
      return 0;
  12. On implementations with long double numbers having more precision than the one declared by the LDBL_MANT_DIG macro, like on Mac OS X (where the long double arithmetic is implemented by double-double floating-point expansions), the rounded result returned by mpfr_set_ld can be incorrect. Moreover, one of the tests is slightly incorrect too on such implementations. The second mpfr_set_ld patch fixes these problems.

    The current semantic of mpfr_get_ld is to round the result on LDBL_MANT_DIG binary digits, thus returning a normalized floating-point result (as defined by the ISO C standard) if it can fit in the exponent range. This possibly unnecessary rounding is a feature, not a bug!

    Note that only C binary floating-point arithmetics are currently supported for the conversions between MPFR numbers and C floating types. On other platforms (e.g. the TI-92, which has a decimal arithmetic), the results may be inaccurate.

In addition to the bugs mentioned in the BUGS file:

Changes from version 2.1.0 to version 2.1.1

Back to the MPFR page.