summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Black <dragonheart@gentoo.org>2006-07-18 14:08:38 +0000
committerDaniel Black <dragonheart@gentoo.org>2006-07-18 14:08:38 +0000
commit996e9ca35807ea048d513f975369fc0f099cb484 (patch)
treebcb60a04fefd63ae900097887cd6d90d235cd50f /dev-libs/mpfr
parentStable on amd64 wrt bug #139330. (diff)
downloadgentoo-2-996e9ca35807ea048d513f975369fc0f099cb484.tar.gz
gentoo-2-996e9ca35807ea048d513f975369fc0f099cb484.tar.bz2
gentoo-2-996e9ca35807ea048d513f975369fc0f099cb484.zip
more upstream patches
(Portage version: 2.1.1_pre3-r1)
Diffstat (limited to 'dev-libs/mpfr')
-rw-r--r--dev-libs/mpfr/ChangeLog8
-rw-r--r--dev-libs/mpfr/files/2.2.0/patch11322
-rw-r--r--dev-libs/mpfr/files/2.2.0/patch12202
-rw-r--r--dev-libs/mpfr/files/digest-mpfr-2.2.0_p126
-rw-r--r--dev-libs/mpfr/mpfr-2.2.0_p12.ebuild59
5 files changed, 596 insertions, 1 deletions
diff --git a/dev-libs/mpfr/ChangeLog b/dev-libs/mpfr/ChangeLog
index b5afa54853d0..ecb1f292ea74 100644
--- a/dev-libs/mpfr/ChangeLog
+++ b/dev-libs/mpfr/ChangeLog
@@ -1,6 +1,12 @@
# ChangeLog for dev-libs/mpfr
# Copyright 1999-2006 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/dev-libs/mpfr/ChangeLog,v 1.24 2006/06/27 14:25:33 lu_zero Exp $
+# $Header: /var/cvsroot/gentoo-x86/dev-libs/mpfr/ChangeLog,v 1.25 2006/07/18 14:08:38 dragonheart Exp $
+
+*mpfr-2.2.0_p12 (19 Jul 2006)
+
+ 19 Jul 2006; Daniel Black <dragonheart@gentoo.org> +files/2.2.0/patch11,
+ +files/2.2.0/patch12, +mpfr-2.2.0_p12.ebuild:
+ more upstream patches
27 Jun 2006; Luca Barbato <lu_zero@gentoo.org> mpfr-2.2.0_p10.ebuild:
Marked stable on ppc
diff --git a/dev-libs/mpfr/files/2.2.0/patch11 b/dev-libs/mpfr/files/2.2.0/patch11
new file mode 100644
index 000000000000..2a81cf5da3ff
--- /dev/null
+++ b/dev-libs/mpfr/files/2.2.0/patch11
@@ -0,0 +1,322 @@
+diff -Naurd mpfr-2.2.0-p10/configure.in mpfr-2.2.0-p11/configure.in
+--- mpfr-2.2.0-p10/configure.in 2005-09-17 10:27:28.000000000 +0000
++++ mpfr-2.2.0-p11/configure.in 2005-09-17 10:27:28.000000000 +0000
+@@ -308,12 +308,6 @@
+ AC_CHECK_LIB(gmp, __gmpz_init, [LIBS="-lgmp $LIBS"],
+ [AC_MSG_ERROR(libgmp not found)])
+
+-dnl Check if we can use mpn_sub_nc
+-if test -n "$gmp_internal_file_check" ; then
+- AC_CHECK_FUNC([__gmpn_sub_nc],
+- [AC_DEFINE([MPFR_HAVE_MPN_SUB_NC],1,[Function mpn_sub_nc is available])])
+-fi
+-
+ dnl Check for corresponding 'gmp.h' and libgmp.a
+ AC_MSG_CHECKING(if gmp.h version and libgmp version are the same)
+ AC_RUN_IFELSE([AC_LANG_PROGRAM([[
+diff -Naurd mpfr-2.2.0-p10/configure mpfr-2.2.0-p11/configure
+--- mpfr-2.2.0-p10/configure 2005-10-02 10:49:55.000000000 +0000
++++ mpfr-2.2.0-p11/configure 2006-05-26 22:08:17.000000000 +0000
+@@ -23159,107 +23159,6 @@
+ { (exit 1); exit 1; }; }
+ fi
+
+-
+-if test -n "$gmp_internal_file_check" ; then
+- echo "$as_me:$LINENO: checking for __gmpn_sub_nc" >&5
+-echo $ECHO_N "checking for __gmpn_sub_nc... $ECHO_C" >&6
+-if test "${ac_cv_func___gmpn_sub_nc+set}" = set; then
+- echo $ECHO_N "(cached) $ECHO_C" >&6
+-else
+- cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h. */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
+-/* end confdefs.h. */
+-/* Define __gmpn_sub_nc to an innocuous variant, in case <limits.h> declares __gmpn_sub_nc.
+- For example, HP-UX 11i <limits.h> declares gettimeofday. */
+-#define __gmpn_sub_nc innocuous___gmpn_sub_nc
+-
+-/* System header to define __stub macros and hopefully few prototypes,
+- which can conflict with char __gmpn_sub_nc (); below.
+- Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+- <limits.h> exists even on freestanding compilers. */
+-
+-#ifdef __STDC__
+-# include <limits.h>
+-#else
+-# include <assert.h>
+-#endif
+-
+-#undef __gmpn_sub_nc
+-
+-/* Override any gcc2 internal prototype to avoid an error. */
+-#ifdef __cplusplus
+-extern "C"
+-{
+-#endif
+-/* We use char because int might match the return type of a gcc2
+- builtin and then its argument prototype would still apply. */
+-char __gmpn_sub_nc ();
+-/* The GNU C library defines this for functions which it implements
+- to always fail with ENOSYS. Some functions are actually named
+- something starting with __ and the normal name is an alias. */
+-#if defined (__stub___gmpn_sub_nc) || defined (__stub_____gmpn_sub_nc)
+-choke me
+-#else
+-char (*f) () = __gmpn_sub_nc;
+-#endif
+-#ifdef __cplusplus
+-}
+-#endif
+-
+-int
+-main ()
+-{
+-return f != __gmpn_sub_nc;
+- ;
+- return 0;
+-}
+-_ACEOF
+-rm -f conftest.$ac_objext conftest$ac_exeext
+-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+- (eval $ac_link) 2>conftest.er1
+- ac_status=$?
+- grep -v '^ *+' conftest.er1 >conftest.err
+- rm -f conftest.er1
+- cat conftest.err >&5
+- echo "$as_me:$LINENO: \$? = $ac_status" >&5
+- (exit $ac_status); } &&
+- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+- (eval $ac_try) 2>&5
+- ac_status=$?
+- echo "$as_me:$LINENO: \$? = $ac_status" >&5
+- (exit $ac_status); }; } &&
+- { ac_try='test -s conftest$ac_exeext'
+- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+- (eval $ac_try) 2>&5
+- ac_status=$?
+- echo "$as_me:$LINENO: \$? = $ac_status" >&5
+- (exit $ac_status); }; }; then
+- ac_cv_func___gmpn_sub_nc=yes
+-else
+- echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
+-
+-ac_cv_func___gmpn_sub_nc=no
+-fi
+-rm -f conftest.err conftest.$ac_objext \
+- conftest$ac_exeext conftest.$ac_ext
+-fi
+-echo "$as_me:$LINENO: result: $ac_cv_func___gmpn_sub_nc" >&5
+-echo "${ECHO_T}$ac_cv_func___gmpn_sub_nc" >&6
+-if test $ac_cv_func___gmpn_sub_nc = yes; then
+-
+-cat >>confdefs.h <<\_ACEOF
+-#define MPFR_HAVE_MPN_SUB_NC 1
+-_ACEOF
+-
+-fi
+-
+-fi
+-
+ echo "$as_me:$LINENO: checking if gmp.h version and libgmp version are the same" >&5
+ echo $ECHO_N "checking if gmp.h version and libgmp version are the same... $ECHO_C" >&6
+ if test "$cross_compiling" = yes; then
+diff -Naurd mpfr-2.2.0-p10/div.c mpfr-2.2.0-p11/div.c
+--- mpfr-2.2.0-p10/div.c 2005-11-24 21:39:31.000000000 +0000
++++ mpfr-2.2.0-p11/div.c 2006-05-26 21:00:45.000000000 +0000
+@@ -23,9 +23,9 @@
+ #include "mpfr-impl.h"
+
+ #ifdef DEBUG
+-#define mpn_print(ap,n) mpn_print3(ap,n,MPFR_LIMB_ZERO)
++#define mpfr_mpn_print(ap,n) mpfr_mpn_print3 (ap,n,MPFR_LIMB_ZERO)
+ static void
+-mpn_print3 (mp_ptr ap, mp_size_t n, mp_limb_t cy)
++mpfr_mpn_print3 (mp_ptr ap, mp_size_t n, mp_limb_t cy)
+ {
+ mp_size_t i;
+ for (i = 0; i < n; i++)
+@@ -38,7 +38,7 @@
+
+ /* check if {ap, an} is zero */
+ static int
+-mpn_cmpzero (mp_ptr ap, mp_size_t an)
++mpfr_mpn_cmpzero (mp_ptr ap, mp_size_t an)
+ {
+ while (an > 0)
+ if (MPFR_LIKELY(ap[--an] != MPFR_LIMB_ZERO))
+@@ -51,7 +51,7 @@
+ Takes into account bp[0] for extra=1.
+ */
+ static int
+-mpn_cmp_aux (mp_ptr ap, mp_size_t an, mp_ptr bp, mp_size_t bn, int extra)
++mpfr_mpn_cmp_aux (mp_ptr ap, mp_size_t an, mp_ptr bp, mp_size_t bn, int extra)
+ {
+ int cmp = 0;
+ mp_size_t k;
+@@ -103,20 +103,23 @@
+ return cmp;
+ }
+
+-/* {ap, n} <- {ap, n} - {bp, n} >> extra - cy, with cy=0 or 1 */
++/* {ap, n} <- {ap, n} - {bp, n} >> extra - cy, with cy = 0 or 1 */
+ static mp_limb_t
+-mpn_sub_aux (mp_ptr ap, mp_ptr bp, mp_size_t n, mp_limb_t cy, int extra)
++mpfr_mpn_sub_aux (mp_ptr ap, mp_ptr bp, mp_size_t n, mp_limb_t cy, int extra)
+ {
+ mp_limb_t bb, rp;
++ MPFR_ASSERTD (cy <= 1);
+ while (n--)
+ {
+ bb = (extra) ? ((bp[1] << (BITS_PER_MP_LIMB-1)) | (bp[0] >> 1)) : bp[0];
+ rp = ap[0] - bb - cy;
+- cy = ((ap[0] < bb) || (cy && ~rp == MPFR_LIMB_ZERO)) ? MPFR_LIMB_ONE : MPFR_LIMB_ZERO;
++ cy = (ap[0] < bb) || (cy && ~rp == MPFR_LIMB_ZERO) ?
++ MPFR_LIMB_ONE : MPFR_LIMB_ZERO;
+ ap[0] = rp;
+ ap ++;
+ bp ++;
+ }
++ MPFR_ASSERTD (cy <= 1);
+ return cy;
+ }
+
+@@ -234,7 +237,7 @@
+ else if (l == 0) /* no more divisor limb */
+ extra_bit = 1;
+ else /* k=0: no more dividend limb */
+- extra_bit = mpn_cmpzero (vp, l) == 0;
++ extra_bit = mpfr_mpn_cmpzero (vp, l) == 0;
+ }
+ #ifdef DEBUG
+ printf ("extra_bit=%u\n", extra_bit);
+@@ -278,7 +281,7 @@
+ sticky_u = mpn_rshift (ap, up + k, qqsize, 1);
+ else
+ MPN_COPY(ap, up + k, qqsize);
+- sticky_u = sticky_u || mpn_cmpzero (up, k);
++ sticky_u = sticky_u || mpfr_mpn_cmpzero (up, k);
+ }
+ low_u = sticky_u;
+
+@@ -297,7 +300,7 @@
+ bp = (mp_ptr) MPFR_TMP_ALLOC (qsize * sizeof(mp_limb_t));
+ MPN_COPY(bp, vp, vsize);
+ }
+- sticky_v = sticky_v || mpn_cmpzero (vp, k);
++ sticky_v = sticky_v || mpfr_mpn_cmpzero (vp, k);
+ k = 0;
+ }
+ else /* vsize < qsize: small divisor case */
+@@ -310,12 +313,12 @@
+ qh = mpn_divrem (qp, 0, ap + k, qqsize - k, bp, qsize - k);
+ /* warning: qh may be 1 if u1 == v1, but u < v */
+ #ifdef DEBUG
+- printf ("q="); mpn_print (qp, qsize);
+- printf ("r="); mpn_print (ap, qsize);
++ printf ("q="); mpfr_mpn_print (qp, qsize);
++ printf ("r="); mpfr_mpn_print (ap, qsize);
+ #endif
+
+ k = qsize;
+- sticky_u = sticky_u || mpn_cmpzero (ap, k);
++ sticky_u = sticky_u || mpfr_mpn_cmpzero (ap, k);
+
+ sticky = sticky_u | sticky_v;
+
+@@ -417,9 +420,9 @@
+ cmp_s_r = mpn_cmp (sp + k, ap, qsize);
+ if (cmp_s_r == 0) /* compare {sp, k} and low(u) */
+ {
+- cmp_s_r = (usize >= qqsize)
+- ? mpn_cmp_aux (sp, k, up, usize-qqsize, extra_bit)
+- : mpn_cmpzero (sp, k);
++ cmp_s_r = (usize >= qqsize) ?
++ mpfr_mpn_cmp_aux (sp, k, up, usize-qqsize, extra_bit) :
++ mpfr_mpn_cmpzero (sp, k);
+ }
+ #ifdef DEBUG
+ printf ("cmp(q*v0,r+u0)=%d\n", cmp_s_r);
+@@ -441,25 +444,30 @@
+ mp_size_t m;
+ l = usize - qqsize; /* number of low limbs in u */
+ m = (l > k) ? l - k : 0;
+- cy = (extra_bit) ? (up[m] & MPFR_LIMB_ONE) : MPFR_LIMB_ZERO;
++ cy = (extra_bit) ?
++ (up[m] & MPFR_LIMB_ONE) : MPFR_LIMB_ZERO;
+ if (l >= k) /* u0 has more limbs */
+ {
+- cy = cy || mpn_cmpzero (up, m);
++ cy = cy || mpfr_mpn_cmpzero (up, m);
+ low_u = cy;
+- cy = mpn_sub_aux (sp, up + l - k, k,
+- (cy) ? MPFR_LIMB_ONE : MPFR_LIMB_ZERO, extra_bit);
++ cy = mpfr_mpn_sub_aux (sp, up + l - k, k,
++ cy, extra_bit);
+ }
+ else /* l < k: s has more limbs than u0 */
+ {
+ low_u = MPFR_LIMB_ZERO;
+ if (cy != MPFR_LIMB_ZERO)
+- cy = mpn_sub_1 (sp + k - l - 1, sp + k - l - 1, 1, MPFR_LIMB_HIGHBIT);
+- cy = mpn_sub_aux (sp + k - l, up, l, cy, extra_bit);
++ cy = mpn_sub_1 (sp + k - l - 1, sp + k - l - 1,
++ 1, MPFR_LIMB_HIGHBIT);
++ cy = mpfr_mpn_sub_aux (sp + k - l, up, l,
++ cy, extra_bit);
+ }
+ }
++ MPFR_ASSERTD (cy <= 1);
+ cy = mpn_sub_1 (sp + k, sp + k, qsize, cy);
+ /* subtract r */
+- cy = mpn_sub_nc (sp + k, sp + k, ap, qsize, cy);
++ cy += mpn_sub_n (sp + k, sp + k, ap, qsize);
++ MPFR_ASSERTD (cy <= 1);
+ /* now compare {sp, ssize} to v */
+ cmp_s_r = mpn_cmp (sp, vp, vsize);
+ if (cmp_s_r == 0 && low_u != MPFR_LIMB_ZERO)
+diff -Naurd mpfr-2.2.0-p10/mpfr-gmp.c mpfr-2.2.0-p11/mpfr-gmp.c
+--- mpfr-2.2.0-p10/mpfr-gmp.c 2005-08-18 17:03:09.000000000 +0000
++++ mpfr-2.2.0-p11/mpfr-gmp.c 2006-05-26 21:00:45.000000000 +0000
+@@ -373,18 +373,3 @@
+ }
+
+ #endif /* Have gmp-impl.h */
+-
+-#ifndef MPFR_HAVE_MPN_SUB_NC
+-mp_limb_t
+-mpfr_sub_nc (mp_ptr dest, mp_srcptr op1, mp_srcptr op2, mp_size_t s,
+- mp_limb_t c)
+-{
+- mp_limb_t c2;
+- c2 = mpn_sub_n (dest, op1, op2, s);
+- MPFR_ASSERTD (c+c2 < MPFR_LIMB_HIGHBIT);
+- c2 = mpn_sub_1 (dest, dest, s, c+c2);
+- return c2;
+-}
+-
+-#endif /* !Have MPFR_HAVE_MPN_SUB_NC */
+-
+diff -Naurd mpfr-2.2.0-p10/mpfr-impl.h mpfr-2.2.0-p11/mpfr-impl.h
+--- mpfr-2.2.0-p10/mpfr-impl.h 2005-11-23 09:04:29.000000000 +0000
++++ mpfr-2.2.0-p11/mpfr-impl.h 2006-05-26 21:00:45.000000000 +0000
+@@ -153,15 +153,6 @@
+ # error "Can't compute log2(BITS_PER_MP_LIMB)"
+ #endif
+
+-/* mpn_sub_nc is internal but may be defined in the header
+- but not in the library! That's why we may need to overide it.*/
+-#ifndef MPFR_HAVE_MPN_SUB_NC
+-mp_limb_t mpfr_sub_nc _MPFR_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t,
+- mp_limb_t ));
+-#undef mpn_sub_nc
+-#define mpn_sub_nc mpfr_sub_nc
+-#endif
+-
+ #if __MPFR_GNUC(3,0) || __MPFR_ICC(8,1,0)
+ # define MPFR_NORETURN_ATTR __attribute__ ((noreturn))
+ # define MPFR_CONST_ATTR __attribute__ ((const))
diff --git a/dev-libs/mpfr/files/2.2.0/patch12 b/dev-libs/mpfr/files/2.2.0/patch12
new file mode 100644
index 000000000000..67509dd7b2bd
--- /dev/null
+++ b/dev-libs/mpfr/files/2.2.0/patch12
@@ -0,0 +1,202 @@
+diff -Naurd mpfr-2.2.0-p11/get_f.c mpfr-2.2.0-p12/get_f.c
+--- mpfr-2.2.0-p11/get_f.c 2006-01-13 15:04:34.000000000 +0000
++++ mpfr-2.2.0-p12/get_f.c 2006-05-26 21:10:14.000000000 +0000
+@@ -29,6 +29,7 @@
+ {
+ mp_size_t sx, sy;
+ mp_prec_t precx, precy;
++ mp_limb_t *xp;
+ int sh;
+
+ if (MPFR_UNLIKELY(MPFR_IS_SINGULAR(y)))
+@@ -48,6 +49,8 @@
+ precx = (mp_prec_t) sx * BITS_PER_MP_LIMB;
+ sy = MPFR_LIMB_SIZE (y);
+
++ xp = PTR (x);
++
+ /* since mpf numbers are represented in base 2^BITS_PER_MP_LIMB,
+ we loose -EXP(y) % BITS_PER_MP_LIMB bits in the most significant limb */
+ sh = MPFR_GET_EXP(y) % BITS_PER_MP_LIMB;
+@@ -55,20 +58,31 @@
+ MPFR_ASSERTD (sh >= 0);
+ if (precy + sh <= precx) /* we can copy directly */
+ {
++ mp_size_t ds;
++
+ MPFR_ASSERTN (sx >= sy);
++ ds = sx - sy;
++
+ if (sh != 0)
+- mpn_rshift (PTR(x) + sx - sy, MPFR_MANT(y), sy, sh);
++ {
++ mp_limb_t out;
++ out = mpn_rshift (xp + ds, MPFR_MANT(y), sy, sh);
++ MPFR_ASSERTN (ds > 0 || out == 0);
++ if (ds > 0)
++ xp[--ds] = out;
++ }
+ else
+- MPN_COPY (PTR(x) + sx - sy, MPFR_MANT(y), sy);
+- if (sx > sy)
+- MPN_ZERO (PTR(x), sx - sy);
++ MPN_COPY (xp + ds, MPFR_MANT (y), sy);
++ if (ds > 0)
++ MPN_ZERO (xp, ds);
+ EXP(x) = (MPFR_GET_EXP(y) + sh) / BITS_PER_MP_LIMB;
+ }
+ else /* we have to round to precx - sh bits */
+ {
+ mpfr_t z;
+- mp_size_t sz;
++ mp_size_t sz, ds;
+
++ /* Recall that precx = (mp_prec_t) sx * BITS_PER_MP_LIMB */
+ mpfr_init2 (z, precx - sh);
+ sz = MPFR_LIMB_SIZE (z);
+ mpfr_set (z, y, rnd_mode);
+@@ -76,13 +90,21 @@
+ thus we can safely ignore its last bit which is 0 */
+ sh = MPFR_GET_EXP(z) % BITS_PER_MP_LIMB;
+ sh = sh <= 0 ? - sh : BITS_PER_MP_LIMB - sh;
+- MPFR_ASSERTD (sh >= 0);
++ MPFR_ASSERTD (sx >= sz);
++ ds = sx - sz;
++ MPFR_ASSERTD (sh >= 0 && ds <= 1);
+ if (sh != 0)
+- mpn_rshift (PTR(x) + sx - sz, MPFR_MANT(z), sz, sh);
++ {
++ mp_limb_t out;
++ out = mpn_rshift (xp + ds, MPFR_MANT(z), sz, sh);
++ /* If sh hasn't changed, it is the number of the non-significant
++ bits in the lowest limb of z. Therefore out == 0. */
++ MPFR_ASSERTD (out == 0);
++ }
+ else
+- MPN_COPY (PTR(x) + sx - sz, MPFR_MANT(z), sz);
+- if (sx > sz)
+- MPN_ZERO (PTR(x), sx - sz);
++ MPN_COPY (xp + ds, MPFR_MANT(z), sz);
++ if (ds != 0)
++ xp[0] = 0;
+ EXP(x) = (MPFR_GET_EXP(z) + sh) / BITS_PER_MP_LIMB;
+ mpfr_clear (z);
+ }
+diff -Naurd mpfr-2.2.0-p11/tests/tget_f.c mpfr-2.2.0-p12/tests/tget_f.c
+--- mpfr-2.2.0-p11/tests/tget_f.c 2006-01-13 15:05:14.000000000 +0000
++++ mpfr-2.2.0-p12/tests/tget_f.c 2006-05-26 21:10:14.000000000 +0000
+@@ -26,18 +26,84 @@
+
+ #include "mpfr-test.h"
+
++/* Test that there is no lost of accuracy when converting a mpfr_t number
++ into a mpf_t number (test with various precisions and exponents). */
++static void
++prec_test (void)
++{
++ int px, py;
++
++ for (py = 3; py <= 136; py++)
++ {
++ mpfr_t y1, y2, y3;
++
++ mpfr_init2 (y1, py);
++ mpfr_init2 (y2, py);
++ mpfr_init2 (y3, py);
++
++ for (px = 32; px <= 160; px += 32)
++ {
++ mpf_t x1, x2, x3;
++ int e;
++
++ mpf_init (x1);
++ mpf_init (x2);
++ mpf_init (x3);
++ mpfr_set_ui_2exp (y1, 1, py - 1, GMP_RNDN);
++ mpfr_get_f (x1, y1, GMP_RNDN); /* exact (power of 2) */
++ mpf_set (x2, x1);
++ mpfr_set (y2, y1, GMP_RNDN);
++
++ for (e = py - 2; e >= 0; e--)
++ {
++ int inex;
++ mpf_div_2exp (x2, x2, 1);
++ mpf_add (x1, x1, x2);
++ mpfr_div_2exp (y2, y2, 1, GMP_RNDN);
++ inex = mpfr_add (y1, y1, y2, GMP_RNDN);
++ MPFR_ASSERTN (inex == 0);
++ mpfr_set_f (y3, x1, GMP_RNDN);
++ if (! mpfr_equal_p (y1, y3))
++ break;
++ mpfr_get_f (x3, y3, GMP_RNDN);
++ if (mpf_cmp (x1, x3) != 0)
++ {
++ printf ("Error in prec_test (px = %d, py = %d, e = %d)\n",
++ px, py, e);
++ printf ("x1 = ");
++ mpf_out_str (stdout, 16, 0, x1);
++ printf ("\nx2 = ");
++ mpf_out_str (stdout, 16, 0, x1);
++ printf ("\n");
++ exit (1);
++ }
++ }
++
++ mpf_clear (x1);
++ mpf_clear (x2);
++ mpf_clear (x3);
++ }
++
++ mpfr_clear (y1);
++ mpfr_clear (y2);
++ mpfr_clear (y3);
++ }
++}
++
+ int
+ main (void)
+ {
+ mpf_t x;
+- mpfr_t y;
++ mpfr_t y, z;
+ unsigned long i;
+ mp_exp_t e;
++ int inex;
+
+ MPFR_TEST_USE_RANDS ();
+ tests_start_mpfr ();
+
+ mpfr_init (y);
++ mpfr_init (z);
+ mpf_init (x);
+
+ mpfr_set_nan (y);
+@@ -154,9 +220,28 @@
+ }
+ }
+
++ /* Bug reported by Yury Lukach on 2006-04-05 */
++ mpfr_set_prec (y, 32);
++ mpfr_set_prec (z, 32);
++ mpf_set_prec (x, 32);
++ mpfr_set_ui_2exp (y, 0xc1234567, -30, GMP_RNDN);
++ mpfr_get_f (x, y, GMP_RNDN);
++ inex = mpfr_set_f (z, x, GMP_RNDN);
++ if (inex || ! mpfr_equal_p (y, z))
++ {
++ printf ("Error in mpfr_get_f:\n inex = %d, y = ", inex);
++ mpfr_dump (z);
++ printf ("Expected:\n inex = 0, y = ");
++ mpfr_dump (y);
++ exit (1);
++ }
++
+ mpfr_clear (y);
++ mpfr_clear (z);
+ mpf_clear (x);
+
++ prec_test ();
++
+ tests_end_mpfr ();
+ return 0;
+ }
diff --git a/dev-libs/mpfr/files/digest-mpfr-2.2.0_p12 b/dev-libs/mpfr/files/digest-mpfr-2.2.0_p12
new file mode 100644
index 000000000000..4d1063c367b4
--- /dev/null
+++ b/dev-libs/mpfr/files/digest-mpfr-2.2.0_p12
@@ -0,0 +1,6 @@
+MD5 1a81f721ee78cb027f6c41a243d3a33d mpfr-2.2.0.tar.bz2 728490
+RMD160 5243eb0387392123d9d30ca009b30147a51370a6 mpfr-2.2.0.tar.bz2 728490
+SHA256 cea002a11707b5f8fb2147686145563e5f313fc62558e8400444bdcf89971e6a mpfr-2.2.0.tar.bz2 728490
+MD5 5c4db32dfaef7d032e2f359cacebf7ce mpfr-2.2.0_p5 27251
+RMD160 7e60b2be4691235de88646534b64cd12cdc1a45d mpfr-2.2.0_p5 27251
+SHA256 1e253c48800667d295e5ec3407b8e27a86e385706ecb49a7dc51503839752309 mpfr-2.2.0_p5 27251
diff --git a/dev-libs/mpfr/mpfr-2.2.0_p12.ebuild b/dev-libs/mpfr/mpfr-2.2.0_p12.ebuild
new file mode 100644
index 000000000000..86ac19b30576
--- /dev/null
+++ b/dev-libs/mpfr/mpfr-2.2.0_p12.ebuild
@@ -0,0 +1,59 @@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-libs/mpfr/mpfr-2.2.0_p12.ebuild,v 1.1 2006/07/18 14:08:38 dragonheart Exp $
+
+inherit eutils flag-o-matic autotools
+
+MY_PV=${PV/_p*}
+MY_P=${PN}-${MY_PV}
+PLEVEL=${PV/*p}
+DESCRIPTION="library for multiple-precision floating-point computations with exact rounding"
+HOMEPAGE="http://www.mpfr.org/"
+SRC_URI="http://www.mpfr.org/mpfr-current/${MY_P}.tar.bz2
+ mirror://gentoo/mpfr-2.2.0_p5"
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+IUSE=""
+
+DEPEND=">=dev-libs/gmp-4.1.4-r2"
+
+S=${WORKDIR}/${MY_P}
+
+src_unpack() {
+ unpack "${MY_P}.tar.bz2"
+ cd "${S}"
+ for ((i=1; i<=PLEVEL; ++i)) ; do
+ patch=patch$(printf '%02d' ${i})
+ if [[ -f ${FILESDIR}/${MY_PV}/${patch} ]] ; then
+ epatch "${FILESDIR}"/${MY_PV}/${patch}
+ elif [[ -f ${DISTDIR}/${PN}-${MY_PV}_p${i} ]] ; then
+ epatch "${DISTDIR}"/${PN}-${MY_PV}_p${i}
+ else
+ ewarn "${DISTDIR}/${PN}-${MY_PV}_p${i}"
+ die "patch ${i} missing - please report to bugs.gentoo.org"
+ fi
+ done
+
+ # Disable buggy code on s390/hppa #126082
+ epatch "${FILESDIR}"/${MY_PV}/debian-disable-buggy-umul_ppmm.patch
+ eautoreconf
+}
+
+src_compile() {
+ # tests fail on amd64 with -ffast-math, maybe other arches too
+ use amd64 && filter-flags -ffast-math
+
+ econf \
+ --enable-shared \
+ --enable-static \
+ || die
+ emake || die
+}
+
+src_install() {
+ make install DESTDIR="${D}" || die
+ dodoc AUTHORS BUGS ChangeLog NEWS README TODO
+ dohtml *.html
+}