diff -Naurd mpfr-2.3.0-a/PATCHES mpfr-2.3.0-b/PATCHES --- mpfr-2.3.0-a/PATCHES 2007-10-05 12:20:54.000000000 +0000 +++ mpfr-2.3.0-b/PATCHES 2007-10-05 12:21:12.000000000 +0000 @@ -0,0 +1 @@ +mpfr_atan2 diff -Naurd mpfr-2.3.0-a/VERSION mpfr-2.3.0-b/VERSION --- mpfr-2.3.0-a/VERSION 2007-09-03 00:02:12.000000000 +0000 +++ mpfr-2.3.0-b/VERSION 2007-10-05 12:21:06.000000000 +0000 @@ -1 +1 @@ -2.3.0-p2 +2.3.0-p3 diff -Naurd mpfr-2.3.0-a/atan2.c mpfr-2.3.0-b/atan2.c --- mpfr-2.3.0-a/atan2.c 2007-08-29 10:18:11.000000000 +0000 +++ mpfr-2.3.0-b/atan2.c 2007-10-05 12:21:01.000000000 +0000 @@ -170,6 +170,7 @@ /* use atan2(y,x) = atan(y/x) */ for (;;) { + mpfr_clear_flags (); if (mpfr_div (tmp, y, x, GMP_RNDN) == 0) { /* Result is exact. */ diff -Naurd mpfr-2.3.0-a/mpfr.h mpfr-2.3.0-b/mpfr.h --- mpfr-2.3.0-a/mpfr.h 2007-09-03 00:02:12.000000000 +0000 +++ mpfr-2.3.0-b/mpfr.h 2007-10-05 12:21:06.000000000 +0000 @@ -27,7 +27,7 @@ #define MPFR_VERSION_MAJOR 2 #define MPFR_VERSION_MINOR 3 #define MPFR_VERSION_PATCHLEVEL 0 -#define MPFR_VERSION_STRING "2.3.0-p2" +#define MPFR_VERSION_STRING "2.3.0-p3" /* Macros dealing with MPFR VERSION */ #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c)) diff -Naurd mpfr-2.3.0-a/tests/tatan.c mpfr-2.3.0-b/tests/tatan.c --- mpfr-2.3.0-a/tests/tatan.c 2007-08-29 10:18:10.000000000 +0000 +++ mpfr-2.3.0-b/tests/tatan.c 2007-10-05 12:21:01.000000000 +0000 @@ -405,6 +405,40 @@ mpfr_clears (a, x, y, (void *) 0); } +/* Bug found by Robert Bajema (regression in MPFR 2.3.0). + The cause is the underflow flag set before the mpfr_atan2 call. */ +static void +atan2_bug_20071003 (void) +{ + mpfr_t a, x, y, z; + + mpfr_inits (a, x, y, z, (void *) 0); + + mpfr_set_underflow (); + mpfr_set_str_binary (y, + "-0.10100110110100110111010110111111100110100010001110110E2"); + mpfr_set_str_binary (x, + "0.10100101010110010100010010111000110110011110001011110E3"); + mpfr_set_str_binary (z, + "-0.11101111001101101100111011001101000010010111101110110E-1"); + mpfr_atan2 (a, y, x, GMP_RNDN); + if (! mpfr_equal_p (a, z)) + { + printf ("mpfr_atan2 fails on:\n"); + printf (" y = "); + mpfr_dump (y); + printf (" x = "); + mpfr_dump (x); + printf ("Expected "); + mpfr_dump (z); + printf ("Got "); + mpfr_dump (a); + exit (1); + } + + mpfr_clears (a, x, y, z, (void *) 0); +} + int main (int argc, char *argv[]) { @@ -414,6 +448,7 @@ special (); special_atan2 (); smallvals_atan2 (); + atan2_bug_20071003 (); test_generic_atan (2, 200, 17); test_generic_atan2 (2, 200, 17); diff -Naurd mpfr-2.3.0-a/version.c mpfr-2.3.0-b/version.c --- mpfr-2.3.0-a/version.c 2007-09-03 00:02:12.000000000 +0000 +++ mpfr-2.3.0-b/version.c 2007-10-05 12:21:06.000000000 +0000 @@ -25,5 +25,5 @@ const char * mpfr_get_version (void) { - return "2.3.0-p2"; + return "2.3.0-p3"; }