summaryrefslogtreecommitdiff
path: root/patches/mpfr/3.0.1/130-atan-expo-range.patch
blob: 251b837320421b0cf170e11e82405252953ebde6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
diff -Naurd mpfr-3.0.1-a/PATCHES mpfr-3.0.1-b/PATCHES
--- mpfr-3.0.1-a/PATCHES	2011-05-05 00:00:35.000000000 +0000
+++ mpfr-3.0.1-b/PATCHES	2011-05-05 00:00:35.000000000 +0000
@@ -0,0 +1 @@
+atan-expo-range
diff -Naurd mpfr-3.0.1-a/VERSION mpfr-3.0.1-b/VERSION
--- mpfr-3.0.1-a/VERSION	2011-05-04 11:18:33.000000000 +0000
+++ mpfr-3.0.1-b/VERSION	2011-05-05 00:00:35.000000000 +0000
@@ -1 +1 @@
-3.0.1-p2
+3.0.1-p3
diff -Naurd mpfr-3.0.1-a/atan.c mpfr-3.0.1-b/atan.c
--- mpfr-3.0.1-a/atan.c	2011-04-04 10:19:18.000000000 +0000
+++ mpfr-3.0.1-b/atan.c	2011-05-05 00:00:35.000000000 +0000
@@ -431,5 +431,5 @@
   MPFR_GROUP_CLEAR (group);
 
   MPFR_SAVE_EXPO_FREE (expo);
-  return mpfr_check_range (arctgt, inexact, rnd_mode);
+  return mpfr_check_range (atan, inexact, rnd_mode);
 }
diff -Naurd mpfr-3.0.1-a/mpfr.h mpfr-3.0.1-b/mpfr.h
--- mpfr-3.0.1-a/mpfr.h	2011-05-04 11:18:33.000000000 +0000
+++ mpfr-3.0.1-b/mpfr.h	2011-05-05 00:00:35.000000000 +0000
@@ -27,7 +27,7 @@
 #define MPFR_VERSION_MAJOR 3
 #define MPFR_VERSION_MINOR 0
 #define MPFR_VERSION_PATCHLEVEL 1
-#define MPFR_VERSION_STRING "3.0.1-p2"
+#define MPFR_VERSION_STRING "3.0.1-p3"
 
 /* Macros dealing with MPFR VERSION */
 #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
diff -Naurd mpfr-3.0.1-a/tests/tatan.c mpfr-3.0.1-b/tests/tatan.c
--- mpfr-3.0.1-a/tests/tatan.c	2011-04-04 10:19:17.000000000 +0000
+++ mpfr-3.0.1-b/tests/tatan.c	2011-05-05 00:00:35.000000000 +0000
@@ -535,6 +535,52 @@
   mpfr_clears (a, x, y, (mpfr_ptr) 0);
 }
 
+/* http://websympa.loria.fr/wwsympa/arc/mpfr/2011-05/msg00008.html
+ * Incorrect flags (in debug mode on a 32-bit machine, assertion failure).
+ */
+static void
+reduced_expo_range (void)
+{
+  mpfr_exp_t emin, emax;
+  mpfr_t x, y, ex_y;
+  int inex, ex_inex;
+  unsigned int flags, ex_flags;
+
+  emin = mpfr_get_emin ();
+  emax = mpfr_get_emax ();
+
+  mpfr_inits2 (12, x, y, ex_y, (mpfr_ptr) 0);
+  mpfr_set_str (x, "0.1e-5", 2, MPFR_RNDN);
+
+  mpfr_set_emin (-5);
+  mpfr_set_emax (-5);
+  mpfr_clear_flags ();
+  inex = mpfr_atan (y, x, MPFR_RNDN);
+  flags = __gmpfr_flags;
+  mpfr_set_emin (emin);
+  mpfr_set_emax (emax);
+
+  mpfr_set_str (ex_y, "0.1e-5", 2, MPFR_RNDN);
+  ex_inex = 1;
+  ex_flags = MPFR_FLAGS_INEXACT;
+
+  if (SIGN (inex) != ex_inex || flags != ex_flags ||
+      ! mpfr_equal_p (y, ex_y))
+    {
+      printf ("Error in reduced_expo_range\non x = ");
+      mpfr_dump (x);
+      printf ("Expected y = ");
+      mpfr_out_str (stdout, 2, 0, ex_y, MPFR_RNDN);
+      printf ("\n         inex = %d, flags = %u\n", ex_inex, ex_flags);
+      printf ("Got      y = ");
+      mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN);
+      printf ("\n         inex = %d, flags = %u\n", SIGN (inex), flags);
+      exit (1);
+    }
+
+  mpfr_clears (x, y, ex_y, (mpfr_ptr) 0);
+}
+
 int
 main (int argc, char *argv[])
 {
@@ -546,6 +592,7 @@
   smallvals_atan2 ();
   atan2_bug_20071003 ();
   atan2_different_prec ();
+  reduced_expo_range ();
 
   test_generic_atan  (2, 200, 17);
   test_generic_atan2 (2, 200, 17);
diff -Naurd mpfr-3.0.1-a/version.c mpfr-3.0.1-b/version.c
--- mpfr-3.0.1-a/version.c	2011-05-04 11:18:33.000000000 +0000
+++ mpfr-3.0.1-b/version.c	2011-05-05 00:00:35.000000000 +0000
@@ -25,5 +25,5 @@
 const char *
 mpfr_get_version (void)
 {
-  return "3.0.1-p2";
+  return "3.0.1-p3";
 }