Rename a GMP patch.
-------- diffstat follows --------
/trunk/patches/gmp/4.2.2/100-mpf_set_str.c.patch | 38 0 38 0 ------------------------------
1 file changed, 38 deletions(-)
1 Original patch from: mpf_eq.diff
3 -= BEGIN original header =-
4 -= END original header =-
6 diff -durN gmp-4.2.4.orig/doc/gmp.texi gmp-4.2.4/doc/gmp.texi
7 --- gmp-4.2.4.orig/doc/gmp.texi 2008-09-18 17:36:14.000000000 +0200
8 +++ gmp-4.2.4/doc/gmp.texi 2009-03-08 18:36:16.000000000 +0100
10 equal, zero otherwise. I.e., test if @var{op1} and @var{op2} are approximately
13 -Caution: Currently only whole limbs are compared, and only in an exact
14 -fashion. In the future values like 1000 and 0111 may be considered the same
15 -to 3 bits (on the basis that their difference is that small).
16 +Caution 1: All version of GMP up to version 4.2.4 compared just whole limbs,
17 +meaning sometimes more than @var{op3} bits, sometimes fewer.
19 +Caution 2: This function will consider XXX11...111 and XX100...000 different,
20 +even if ... is replaced by a semi-infinite number of bits. Such numbers are
21 +really just one ulp off, and should be considered equal.
24 @deftypefun void mpf_reldiff (mpf_t @var{rop}, mpf_t @var{op1}, mpf_t @var{op2})
25 diff -durN gmp-4.2.4.orig/mpf/eq.c gmp-4.2.4/mpf/eq.c
26 --- gmp-4.2.4.orig/mpf/eq.c 2007-08-30 20:31:40.000000000 +0200
27 +++ gmp-4.2.4/mpf/eq.c 2009-03-08 18:36:16.000000000 +0100
29 /* mpf_eq -- Compare two floats up to a specified bit #.
31 -Copyright 1993, 1995, 1996, 2001, 2002 Free Software Foundation, Inc.
32 +Copyright 1993, 1995, 1996, 2001, 2002, 2008 Free Software Foundation, Inc.
34 This file is part of the GNU MP Library.
40 +#include "longlong.h"
43 mpf_eq (mpf_srcptr u, mpf_srcptr v, unsigned long int n_bits)
46 mp_size_t usize, vsize, size, i;
54 /* U and V have the same sign and are both non-zero. */
56 /* 2. Are the exponents different? */
58 - return 0; /* ??? handle (uexp = vexp + 1) */
60 - return 0; /* ??? handle (vexp = uexp + 1) */
70 - if (size > (n_bits + GMP_NUMB_BITS - 1) / GMP_NUMB_BITS)
71 - size = (n_bits + GMP_NUMB_BITS - 1) / GMP_NUMB_BITS;
72 + up += usize; /* point just above most significant limb */
73 + vp += vsize; /* point just above most significant limb */
77 + count_leading_zeros (cnt, up[-1]);
78 + if ((vp[-1] >> (GMP_LIMB_BITS - 1 - cnt)) != 1)
79 + return 0; /* msb positions different */
81 - for (i = size - 1; i >= 0; i--)
82 + n_bits += cnt - GMP_NAIL_BITS;
84 + size = MIN (size, (n_bits + GMP_NUMB_BITS - 1) / GMP_NUMB_BITS);
86 + up -= size; /* point at least significant relevant limb */
87 + vp -= size; /* point at least significant relevant limb */
89 + for (i = size - 1; i > 0; i--)
96 + diff = (up[0] ^ vp[0]) >> GMP_NUMB_BITS - 1 - (n_bits - 1) % GMP_NUMB_BITS;
99 diff -durN gmp-4.2.4.orig/tests/cxx/t-prec.cc gmp-4.2.4/tests/cxx/t-prec.cc
100 --- gmp-4.2.4.orig/tests/cxx/t-prec.cc 2007-09-01 12:09:03.000000000 +0200
101 +++ gmp-4.2.4/tests/cxx/t-prec.cc 2009-03-08 18:36:16.000000000 +0100
103 /* Test precision of mpf_class expressions.
105 -Copyright 2001, 2002, 2003 Free Software Foundation, Inc.
106 +Copyright 2001, 2002, 2003, 2008 Free Software Foundation, Inc.
108 This file is part of the GNU MP Library.
113 (g, "0.11111 11111 11111 11111 11111 11111 11111 11111 11111 11111"
114 - " 11111 11111 11111 11111 11111 11", very_large_prec);
115 + " 11111 11111 11111 11111 11111 111", very_large_prec);
118 mpf_class f(15.0, large_prec);
122 (g, "0.06666 66666 66666 66666 66666 66666 66666 66666 66666 66666"
123 - " 66666 66666 66666 66666 66666 67", very_large_prec);
124 + " 66666 66666 66666 66666 66666 667", very_large_prec);
127 // compound expressions
131 (i, "15.33333 33333 33333 33333 33333 33333 33333 33333 33333 33333"
132 - " 33333 33333 33333 333", very_large_prec);
133 + " 33333 33333 33333 33333 33333 3", very_large_prec);
136 mpf_class f(3.0, small_prec);
137 mpf_class g(-(1 + f) / 3, very_large_prec);
139 (g, "-1.33333 33333 33333 33333 33333 33333 33333 33333 33333 33333"
140 - " 33333 33333 33333 333", very_large_prec);
141 + " 33333 33333 33333 33333 33333 33", very_large_prec);
144 mpf_class f(9.0, medium_prec);
146 g = hypot(1 + 5 / f, 1.0);
148 (g, "1.66666 66666 66666 66666 66666 66666 66666 66666 66666 66666"
149 - " 66666 66666 66666 667", very_large_prec);
150 + " 66666 66666 66666 66666 66666 67", very_large_prec);
153 // compound assignments
155 mpf_class g(0.0, very_large_prec);
156 g = mpf_class(1 / f);
158 - (g, "0.11111 11111 11111 11111 11111 11111 11111 111", medium_prec);
159 + (g, "0.11111 11111 11111 11111 11111 11111 11111 1111", medium_prec);
162 mpf_class f(15.0, large_prec);
164 g = mpf_class(1 / f);
166 (g, "0.06666 66666 66666 66666 66666 66666 66666 66666 66666 66666"
167 - " 66666 667", large_prec);
168 + " 66666 6667", large_prec);
173 mpf_class h(0.0, very_large_prec);
174 h = mpf_class(f / g + 1, large_prec);
176 - (h, "1.33333 33333 33333 33333 33333 33333 33333 33333 33333 3333",
177 + (h, "1.33333 33333 33333 33333 33333 33333 33333 33333 33333 33333"
185 (g, "2.66666 66666 66666 66666 66666 66666 66666 66666 66666 66666"
186 - " 66666 66666 66666 667", very_large_prec);
187 + " 66666 66666 66666 66666 66666 67", very_large_prec);
192 mpf_class g(0.0, very_large_prec);
193 g = mpf_class(f - q, large_prec);
195 - (g, "2.66666 66666 66666 66666 66666 66666 66666 66666 66666 6667",
196 + (g, "2.66666 66666 66666 66666 66666 66666 66666 66666 66666 66666"
202 mpf_class g(0.0, very_large_prec);
203 g = mpf_class(f - q);
205 - (g, "2.66666 66666 66666 66666 66666 6667", medium_prec);
206 + (g, "2.66666 66666 66666 66666 66666 66666 66666 667", medium_prec);
209 mpf_class f(15.0, large_prec);
211 mpf_class g(0.0, very_large_prec);
212 g = mpf_class(f + q);
214 - (g, "15.33333 33333 33333 33333 33333 33333 33333 33333 33333 3333",
215 + (g, "15.33333 33333 33333 33333 33333 33333 33333 33333 33333 33333"