diff -Naur mpfr-2.1.0-p10/rint.c mpfr-2.1.0-p11/rint.c --- mpfr-2.1.0-p10/rint.c 2004-09-30 16:06:25.000000000 +0000 +++ mpfr-2.1.0-p11/rint.c 2005-01-28 13:52:33.000000000 +0000 @@ -1,6 +1,6 @@ /* mpfr_rint -- Round to an integer. -Copyright 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. +Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of the MPFR Library. @@ -205,8 +205,6 @@ uj = un - ui; /* lowest limb of the integer part in u */ rj = rn - ui; /* lowest limb of the integer part in r */ - MPN_ZERO(rp, rj); - if (rp != up) MPN_COPY(rp + rj, up + uj, ui); @@ -270,6 +268,8 @@ (sh == 0 && (MPFR_ASSERTN (uj >= 1), up[uj - 1] & MPFR_LIMB_HIGHBIT) != 0)); } + + MPN_ZERO (rp-rj, rj); } if (sh != 0) diff -Naur mpfr-2.1.0-p10/tests/trint.c mpfr-2.1.0-p11/tests/trint.c --- mpfr-2.1.0-p10/tests/trint.c 2005-01-27 17:38:45.000000000 +0000 +++ mpfr-2.1.0-p11/tests/trint.c 2005-01-28 13:50:56.000000000 +0000 @@ -134,6 +134,19 @@ exit (1); } + /* Bug found by Mark J Watkins */ + mpfr_set_prec (x, 84); + mpfr_set_str_binary (x, + "0.110011010010001000000111101101001111111100101110010000000000000" \ + "000000000000000000000E32"); + mpfr_round (x, x); + if (mpfr_cmp_str (x, "0.1100110100100010000001111011010100000000000000" \ + "00000000000000000000000000000000000000E32", 2, GMP_RNDN)) + { + printf ("Rounding error when dest=src\n"); + exit (1); + } + mpfr_clear (x); mpfr_clear (y); }