Trim old versions

Policy:
- Only latest patchlevel for each branch release
  Exception: CLooG - ISL has dependencies on specific CLooG releases within a
  single branch
- Where there are no patchlevel releases (uClibc, musl) - just retain
  two most recent releases

Also, missed automake update: 1.14 -> 1.14.1

Signed-off-by: Alexey Neyman <stilor@att.net>
This commit is contained in:
Alexey Neyman 2017-08-18 16:17:53 -07:00
parent 5d6ac1b8b1
commit 321990916b
172 changed files with 0 additions and 14039 deletions

View File

@ -1 +0,0 @@
obsolete='yes'

View File

@ -1 +0,0 @@
obsolete='yes'

View File

@ -1 +0,0 @@
obsolete='yes'

View File

@ -1,52 +0,0 @@
From 99fe86f7999afd2743b08c550b10f083ae4bd9bd Mon Sep 17 00:00:00 2001
From: Peter Bergner <bergner@vnet.ibm.com>
Date: Tue, 14 Jul 2015 10:46:16 -0500
Subject: [PATCH] Fix build issue with nat/linux-namespaces.c.
* nat/linux-namespaces.c (setns): Rename from this ...
(do_setns): ... to this. Support calling setns if it exists.
(mnsh_handle_setns): Call do_setns.
---
gdb/ChangeLog | 6 ++++++
gdb/nat/linux-namespaces.c | 12 ++++++------
2 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/gdb/nat/linux-namespaces.c b/gdb/nat/linux-namespaces.c
index a7a3e4d..fd0d4b0 100644
--- a/gdb/nat/linux-namespaces.c
+++ b/gdb/nat/linux-namespaces.c
@@ -34,18 +34,18 @@ int debug_linux_namespaces;
/* Handle systems without setns. */
-#ifndef HAVE_SETNS
-static int
-setns (int fd, int nstype)
+static inline int
+do_setns (int fd, int nstype)
{
-#ifdef __NR_setns
+#ifdef HAVE_SETNS
+ return setns (fd, nstype);
+#elif defined __NR_setns
return syscall (__NR_setns, fd, nstype);
#else
errno = ENOSYS;
return -1;
#endif
}
-#endif
/* Handle systems without MSG_CMSG_CLOEXEC. */
@@ -495,7 +495,7 @@ mnsh_recv_message (int sock, enum mnsh_msg_type *type,
static ssize_t
mnsh_handle_setns (int sock, int fd, int nstype)
{
- int result = setns (fd, nstype);
+ int result = do_setns (fd, nstype);
return mnsh_return_int (sock, result, errno);
}
--
1.9.4

View File

@ -1,28 +0,0 @@
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -17,6 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
+#include "stopcode.h"
#include "defs.h"
#include "inferior.h"
#include "infrun.h"
@@ -73,6 +74,10 @@
#define SPUFS_MAGIC 0x23c9b64e
#endif
+#ifndef __SIGRTMIN
+#define __SIGRTMIN SIGRTMIN
+#endif
+
/* This comment documents high-level logic of this file.
Waiting for events in sync mode
--- /dev/null
+++ b/gdb/stopcode.h
@@ -0,0 +1,4 @@
+#ifndef W_STOPCODE
+#define W_STOPCODE(sig) ((sig) << 8 | 0x7f)
+#endif
+

View File

@ -1,39 +0,0 @@
From 7f8c0d8984bf5754807d3bb543cbc3ffc634e9e4 Mon Sep 17 00:00:00 2001
From: Max Filippov <jcmvbkbc@gmail.com>
Date: Sat, 30 May 2015 13:00:32 +0300
Subject: [PATCH] xtensa: initialize call_abi in xtensa_tdep
Use XSHAL_ABI value provided by xtensa-config.h to correctly initialize
xtensa_tdep.call_abi
This fixes calls to functions from GDB that otherwise fail with the
following assertion in call0 configuration:
gdb/regcache.c:602: internal-error: regcache_raw_read: Assertion
`regnum >= 0 && regnum < regcache->descr->nr_raw_registers' failed.
gdb/
* xtensa-tdep.h (XTENSA_GDBARCH_TDEP_INSTANTIATE): Initialize
call_abi using XSHAL_ABI macro.
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
---
gdb/xtensa-tdep.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/gdb/xtensa-tdep.h b/gdb/xtensa-tdep.h
index adacaf8..3b6ea66 100644
--- a/gdb/xtensa-tdep.h
+++ b/gdb/xtensa-tdep.h
@@ -246,7 +246,8 @@ struct gdbarch_tdep
.spill_location = -1, \
.spill_size = (spillsz), \
.unused = 0, \
- .call_abi = 0, \
+ .call_abi = (XSHAL_ABI == XTHAL_ABI_CALL0) ? \
+ CallAbiCall0Only : CallAbiDefault, \
.debug_interrupt_level = XCHAL_DEBUGLEVEL, \
.icache_line_bytes = XCHAL_ICACHE_LINESIZE, \
.dcache_line_bytes = XCHAL_DCACHE_LINESIZE, \
--
1.8.1.4

View File

@ -1,35 +0,0 @@
From 208ea73d38c9c16cf983b6419f58050dbadcb6a9 Mon Sep 17 00:00:00 2001
From: Max Filippov <jcmvbkbc@gmail.com>
Date: Sun, 7 Jun 2015 22:43:49 +0300
Subject: [PATCH 2/2] xtensa: make sure ar_base is initialized
ar_base is uninitialized for cores w/o windowed registers as their
regmap doesn't have register 0x0100.
Check that ar_base is initialized and if not initialize it with a0_base.
gdb/
* xtensa-tdep.c (xtensa_derive_tdep): Make sure ar_base is
initialized.
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
---
gdb/xtensa-tdep.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c
index 55e7d98..41f5ec1 100644
--- a/gdb/xtensa-tdep.c
+++ b/gdb/xtensa-tdep.c
@@ -3175,6 +3175,9 @@ xtensa_derive_tdep (struct gdbarch_tdep *tdep)
tdep->num_regs = n;
}
+ if (tdep->ar_base == -1)
+ tdep->ar_base = tdep->a0_base;
+
/* Number of pseudo registers. */
tdep->num_pseudo_regs = n - tdep->num_regs;
--
1.8.1.4

View File

@ -1,31 +0,0 @@
From 7f8eacbb468575fb67db7fd1155a3aedaa91911b Mon Sep 17 00:00:00 2001
From: Max Filippov <jcmvbkbc@gmail.com>
Date: Sun, 7 Jun 2015 23:15:39 +0300
Subject: [PATCH] WIP: *end of prologue* detection hack
see
http://www.esp8266.com/viewtopic.php?p=18461#p18461
http://www.esp8266.com/viewtopic.php?p=19026#p19026
http://www.esp8266.com/viewtopic.php?p=19683#p19683
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
---
gdb/xtensa-tdep.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c
index 41f5ec1..6a7dba7 100644
--- a/gdb/xtensa-tdep.c
+++ b/gdb/xtensa-tdep.c
@@ -2410,7 +2410,7 @@ call0_analyze_prologue (struct gdbarch *gdbarch,
/* Find out, if we have an information about the prologue from DWARF. */
prologue_sal = find_pc_line (start, 0);
if (prologue_sal.line != 0) /* Found debug info. */
- body_pc = prologue_sal.end;
+ body_pc = prologue_sal.end + 40;
/* If we are going to analyze the prologue in general without knowing about
the current PC, make the best assumtion for the end of the prologue. */
--
1.8.1.4

View File

@ -1 +0,0 @@
obsolete='yes'

View File

@ -1 +0,0 @@
obsolete='yes'

View File

@ -1 +0,0 @@
obsolete='yes'

View File

@ -1 +0,0 @@
obsolete='yes'

View File

@ -1 +0,0 @@
obsolete='yes'

View File

@ -1 +0,0 @@
obsolete='yes'

View File

@ -1,33 +0,0 @@
diff --git a/mpz/remove.c b/mpz/remove.c
--- a/mpz/remove.c
+++ b/mpz/remove.c
@@ -23,7 +23,7 @@
unsigned long int
mpz_remove (mpz_ptr dest, mpz_srcptr src, mpz_srcptr f)
{
- mpz_t fpow[40]; /* inexhaustible...until year 2020 or so */
+ mpz_t fpow[GMP_LIMB_BITS]; /* Really MP_SIZE_T_BITS */
mpz_t x, rem;
unsigned long int pwr;
int p;
@@ -69,7 +69,7 @@
mpz_set (dest, x);
}
- pwr = (1 << p) - 1;
+ pwr = (1L << p) - 1;
mpz_clear (fpow[p]);
diff --git a/mpz/remove.c b/mpz/remove.c
--- a/mpz/remove.c
+++ b/mpz/remove.c
@@ -80,7 +80,7 @@
mpz_tdiv_qr (x, rem, dest, fpow[p]);
if (SIZ (rem) == 0)
{
- pwr += 1 << p;
+ pwr += 1L << p;
mpz_set (dest, x);
}
mpz_clear (fpow[p]);

View File

@ -1,31 +0,0 @@
diff --git a/mpn/generic/toom44_mul.c b/mpn/generic/toom44_mul.c
--- a/mpn/generic/toom44_mul.c
+++ b/mpn/generic/toom44_mul.c
@@ -116,17 +116,16 @@
TMP_MARK;
- as1 = TMP_SALLOC_LIMBS (n + 1);
- asm1 = TMP_SALLOC_LIMBS (n + 1);
- as2 = TMP_SALLOC_LIMBS (n + 1);
- ash = TMP_SALLOC_LIMBS (n + 1);
- asmh = TMP_SALLOC_LIMBS (n + 1);
-
- bs1 = TMP_SALLOC_LIMBS (n + 1);
- bsm1 = TMP_SALLOC_LIMBS (n + 1);
- bs2 = TMP_SALLOC_LIMBS (n + 1);
- bsh = TMP_SALLOC_LIMBS (n + 1);
- bsmh = TMP_SALLOC_LIMBS (n + 1);
+ as1 = TMP_ALLOC_LIMBS (10 * n + 10);
+ asm1 = as1 + n + 1;
+ as2 = asm1 + n + 1;
+ ash = as2 + n + 1;
+ asmh = ash + n + 1;
+ bs1 = asmh + n + 1;
+ bsm1 = bs1 + n + 1;
+ bs2 = bsm1 + n + 1;
+ bsh = bs2 + n + 1;
+ bsmh = bsh + n + 1;
gp = pp;
hp = pp + n + 1;

View File

@ -1 +0,0 @@
obsolete='yes'

View File

@ -1,33 +0,0 @@
diff --git a/mpz/remove.c b/mpz/remove.c
--- a/mpz/remove.c
+++ b/mpz/remove.c
@@ -23,7 +23,7 @@
unsigned long int
mpz_remove (mpz_ptr dest, mpz_srcptr src, mpz_srcptr f)
{
- mpz_t fpow[40]; /* inexhaustible...until year 2020 or so */
+ mpz_t fpow[GMP_LIMB_BITS]; /* Really MP_SIZE_T_BITS */
mpz_t x, rem;
unsigned long int pwr;
int p;
@@ -69,7 +69,7 @@
mpz_set (dest, x);
}
- pwr = (1 << p) - 1;
+ pwr = (1L << p) - 1;
mpz_clear (fpow[p]);
diff --git a/mpz/remove.c b/mpz/remove.c
--- a/mpz/remove.c
+++ b/mpz/remove.c
@@ -80,7 +80,7 @@
mpz_tdiv_qr (x, rem, dest, fpow[p]);
if (SIZ (rem) == 0)
{
- pwr += 1 << p;
+ pwr += 1L << p;
mpz_set (dest, x);
}
mpz_clear (fpow[p]);

View File

@ -1,31 +0,0 @@
diff --git a/mpn/generic/toom44_mul.c b/mpn/generic/toom44_mul.c
--- a/mpn/generic/toom44_mul.c
+++ b/mpn/generic/toom44_mul.c
@@ -116,17 +116,16 @@
TMP_MARK;
- as1 = TMP_SALLOC_LIMBS (n + 1);
- asm1 = TMP_SALLOC_LIMBS (n + 1);
- as2 = TMP_SALLOC_LIMBS (n + 1);
- ash = TMP_SALLOC_LIMBS (n + 1);
- asmh = TMP_SALLOC_LIMBS (n + 1);
-
- bs1 = TMP_SALLOC_LIMBS (n + 1);
- bsm1 = TMP_SALLOC_LIMBS (n + 1);
- bs2 = TMP_SALLOC_LIMBS (n + 1);
- bsh = TMP_SALLOC_LIMBS (n + 1);
- bsmh = TMP_SALLOC_LIMBS (n + 1);
+ as1 = TMP_ALLOC_LIMBS (10 * n + 10);
+ asm1 = as1 + n + 1;
+ as2 = asm1 + n + 1;
+ ash = as2 + n + 1;
+ asmh = ash + n + 1;
+ bs1 = asmh + n + 1;
+ bsm1 = bs1 + n + 1;
+ bs2 = bsm1 + n + 1;
+ bsh = bs2 + n + 1;
+ bsmh = bsh + n + 1;
gp = pp;
hp = pp + n + 1;

View File

@ -1 +0,0 @@
obsolete='yes'

View File

@ -1,35 +0,0 @@
From: http://gmplib.org:8000/gmp-5.0/raw-rev/794410151f5f
Tweaked to remove the hunk in the Changelog, as it did not apply cleanly
( and who needs Changelogs? ;-) )
# HG changeset patch
# User Torbjorn Granlund <tege@gmplib.org>
# Date 1267122532 -3600
# Node ID 794410151f5f966bcb5c3489b6441614990efe7c
# Parent 948660e2e56d9cfaae035082b8fd473985505fb6
Fix a test case to work for long long limbs.
diff -r 948660e2e56d -r 794410151f5f tests/mpz/t-perfpow.c
--- a/tests/mpz/t-perfpow.c Thu Feb 25 16:08:21 2010 +0100
+++ b/tests/mpz/t-perfpow.c Thu Feb 25 19:28:52 2010 +0100
@@ -2,7 +2,7 @@
Contributed to the GNU project by Torbjorn Granlund and Martin Boij.
-Copyright 2008, 2009 Free Software Foundation, Inc.
+Copyright 2008, 2009, 2010 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -109,7 +109,8 @@
{
mpz_t n, np, temp, primes[NRP];
int i, j, k, unique, destroy, res;
- unsigned long int nrprimes, primebits, g, exp[NRP], e;
+ unsigned long int nrprimes, primebits;
+ mp_limb_t g, exp[NRP], e;
gmp_randstate_ptr rands;
rands = RANDS;

View File

@ -1,38 +0,0 @@
# HG changeset patch
# User Torbjorn Granlund <tege@gmplib.org>
# Date 1310730221 -7200
# Node ID 538dfce27f410b910d5e2f011119269e224d16a3
# Parent 03ed209dd7efd4f4fff0ce297bb3a8f7e7ba2366
(mpn_dcpi1_bdiv_q): Get mpn_sub_1 size argument right.
diff -r 03ed209dd7ef -r 538dfce27f41 mpn/generic/dcpi1_bdiv_q.c
--- a/mpn/generic/dcpi1_bdiv_q.c Thu Jun 16 12:22:24 2011 +0200
+++ b/mpn/generic/dcpi1_bdiv_q.c Fri Jul 15 13:43:41 2011 +0200
@@ -7,7 +7,7 @@
SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST
GUARANTEED THAT THEY WILL CHANGE OR DISAPPEAR IN A FUTURE GMP RELEASE.
-Copyright 2006, 2007, 2009, 2010 Free Software Foundation, Inc.
+Copyright 2006, 2007, 2009, 2010, 2011 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -28,7 +28,6 @@
#include "gmp-impl.h"
-
mp_size_t
mpn_dcpi1_bdiv_q_n_itch (mp_size_t n)
{
@@ -130,7 +129,7 @@
qn = nn - qn;
while (qn > dn)
{
- mpn_sub_1 (np + dn, np + dn, qn, cy);
+ mpn_sub_1 (np + dn, np + dn, qn - dn, cy);
cy = mpn_dcpi1_bdiv_qr_n (qp, np, dp, dn, dinv, tp);
qp += dn;
np += dn;

View File

@ -1,77 +0,0 @@
Removed ChangeLog part
# HG changeset patch
# User Torbjorn Granlund <tege@gmplib.org>
# Date 1342891151 -7200
# Node ID 829215e83ff1db3cd00e510a737092df691442d5
# Parent 816c18dbd492050ef8892e91602d9e758abc2988
Fix r0 clobbering issue with "large" code affecting elf+darwin PIC.
diff -r 816c18dbd492 -r 829215e83ff1 mpn/powerpc32/vmx/mod_34lsub1.asm
--- a/mpn/powerpc32/vmx/mod_34lsub1.asm Tue Jun 19 15:02:48 2012 +0200
+++ b/mpn/powerpc32/vmx/mod_34lsub1.asm Sat Jul 21 19:19:11 2012 +0200
@@ -1,6 +1,7 @@
dnl PowerPC-32 mpn_mod_34lsub1 -- mpn remainder mod 2^24-1.
-dnl Copyright 2002, 2003, 2005, 2006, 2007 Free Software Foundation, Inc.
+dnl Copyright 2002, 2003, 2005, 2006, 2007, 2012 Free Software Foundation,
+dnl Inc.
dnl This file is part of the GNU MP Library.
@@ -135,15 +136,15 @@
andi. r7, up, 15
vxor a0, v0, v0
- lis r0, 0xaaaa
+ lis r9, 0xaaaa
vxor a1, v0, v0
- ori r0, r0, 0xaaab
+ ori r9, r9, 0xaaab
vxor a2, v0, v0
li r5, 16
vxor c0, v0, v0
li r6, 32
vxor c1, v0, v0
- LEAL( r11, cnsts)
+ LEAL( r11, cnsts) C CAUTION clobbers r0 for elf, darwin
vxor c2, v0, v0
vxor z, v0, v0
@@ -158,7 +159,7 @@
vsldoi a2, z, a2, 12
addi n, n, 9
- mulhwu r0, n, r0
+ mulhwu r0, n, r9
srwi r0, r0, 3 C r0 = floor(n/12)
mtctr r0
@@ -174,7 +175,7 @@
vsldoi a1, z, a1, 8
addi n, n, 6
- mulhwu r0, n, r0
+ mulhwu r0, n, r9
srwi r0, r0, 3 C r0 = floor(n/12)
mtctr r0
@@ -188,7 +189,7 @@
vsldoi a0, z, a0, 4
addi n, n, 3
- mulhwu r0, n, r0
+ mulhwu r0, n, r9
srwi r0, r0, 3 C r0 = floor(n/12)
mtctr r0
@@ -197,7 +198,7 @@
b L(0)
L(aligned16):
- mulhwu r0, n, r0
+ mulhwu r0, n, r9
srwi r0, r0, 3 C r0 = floor(n/12)
mtctr r0

View File

@ -1 +0,0 @@
obsolete='yes'

View File

@ -1,21 +0,0 @@
# HG changeset patch
# User Torbjorn Granlund <tege@gmplib.org>
# Date 1368052461 -7200
# Node ID 11fbd825bc45385d00b69c30bd7566acee11f0d2
# Parent bd4c950486ab4c161ea69b91c25150719c3cb700
Fix typo.
diff -r bd4c950486ab -r 11fbd825bc45 mpn/x86_64/bd1/mul_1.asm
--- a/mpn/x86_64/bd1/mul_1.asm Thu May 02 18:20:37 2013 +0200
+++ b/mpn/x86_64/bd1/mul_1.asm Thu May 09 00:34:21 2013 +0200
@@ -53,7 +53,7 @@
IFDOS(` define(`v0', ``%r9'') ') dnl
IFDOS(` define(`r9', ``rdi'') ') dnl
IFDOS(` define(`n', ``%r8'') ') dnl
-IFDOS(` define(`r8', ``r11'') ') dnl
+IFDOS(` define(`r8', ``rbx'') ') dnl
ASM_START()
TEXT

View File

@ -1,39 +0,0 @@
# HG changeset patch
# User Torbjorn Granlund <tege@gmplib.org>
# Date 1363174284 -3600
# Node ID ec4d88674036804b26f22c6a2bfca6ae1e92d370
# Parent e616ff715c34e112d0a5f7535d31ffe1194a5c7d
(mod): Adhere to mpn_mu_div_qr's overlap requirements.
diff -r e616ff715c34 -r ec4d88674036 mpz/powm_ui.c
--- a/mpz/powm_ui.c Sun Feb 17 19:40:16 2013 +0100
+++ b/mpz/powm_ui.c Wed Mar 13 12:31:24 2013 +0100
@@ -2,8 +2,8 @@
Contributed to the GNU project by Torbjorn Granlund.
-Copyright 1991, 1993, 1994, 1996, 1997, 2000, 2001, 2002, 2005, 2008,
-2009, 2011, 2012 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1996, 1997, 2000, 2001, 2002, 2005, 2008, 2009,
+2011, 2012, 2013 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -70,9 +70,14 @@
}
else
{
+ /* We need to allocate separate remainder area, since mpn_mu_div_qr does
+ not handle overlap between the numerator and remainder areas.
+ FIXME: Make it handle such overlap. */
+ mp_ptr rp = TMP_ALLOC_LIMBS (dn);
mp_size_t itch = mpn_mu_div_qr_itch (nn, dn, 0);
mp_ptr scratch = TMP_ALLOC_LIMBS (itch);
- mpn_mu_div_qr (qp, np, np, nn, dp, dn, scratch);
+ mpn_mu_div_qr (qp, rp, np, nn, dp, dn, scratch);
+ MPN_COPY (np, rp, dn);
}
TMP_FREE;

View File

@ -1,164 +0,0 @@
# HG changeset patch
# User Torbjorn Granlund <tege@gmplib.org>
# Date 1373624469 -7200
# Node ID a447c0c537891ed23edf180594a89616364ee633
# Parent 6540e0b2925ead29f7158bb182e4fabfb9441433
Partial rewrite.
diff -r 6540e0b2925e -r a447c0c53789 mpn/generic/sbpi1_div_sec.c
--- a/mpn/generic/sbpi1_div_sec.c Mon Jul 01 19:16:32 2013 +0200
+++ b/mpn/generic/sbpi1_div_sec.c Fri Jul 12 12:21:09 2013 +0200
@@ -8,7 +8,7 @@
SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST
GUARANTEED THAT THEY WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
-Copyright 2011, 2012 Free Software Foundation, Inc.
+Copyright 2011, 2012, 2013 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -29,6 +29,28 @@
#include "gmp-impl.h"
#include "longlong.h"
+/* This side-channel silent division algorithm reduces the partial remainder by
+ GMP_NUMB_BITS/2 bits at a time, compared to GMP_NUMB_BITS for the main
+ division algorithm. We do not insists on reducing by exactly
+ GMP_NUMB_BITS/2, but may leave a partial remainder that is D*B^i to 3D*B^i
+ too large (B is the limb base, D is the divisor, and i is the induction
+ variable); the subsequent step will handle the extra partial remainder bits.
+
+ WIth that partial remainder reduction, each step generates a quotient "half
+ limb". The outer loop generates two quotient half limbs, an upper (q1h) and
+ a lower (q0h) which are stored sparsely in separate limb arrays. These
+ arrays are added at the end; using separate arrays avoids data-dependent
+ carry propagation which could else pose a side-channel leakage problem.
+
+ The quotient half limbs may be between -3 to 0 from the accurate value
+ ("accurate" being the one which corresponds to a reduction to a principal
+ partial remainder). Too small quotient half limbs correspond to too large
+ remainders, which we reduce later, as described above.
+
+ In order to keep quotients from getting too big, corresponding to a negative
+ partial remainder, we use an inverse which is sligtly smaller than usually.
+*/
+
#if OPERATION_sbpi1_div_qr_sec
/* Needs (dn + 1) + (nn - dn) + (nn - dn) = 2nn - dn + 1 limbs at tp. */
#define FNAME mpn_sbpi1_div_qr_sec
@@ -49,7 +71,7 @@
mp_limb_t dinv,
mp_ptr tp)
{
- mp_limb_t nh, cy, q1h, q0h, dummy, h;
+ mp_limb_t nh, cy, q1h, q0h, dummy, cnd;
mp_size_t i;
mp_ptr hp;
#if OPERATION_sbpi1_div_qr_sec
@@ -72,77 +94,69 @@
#endif
}
+ /* Decremenet inverse to keep quotient half limbs from being too large. */
+ dinv -= dinv != 0; /* FIXME: cmp-to-int */
+
/* Create a divisor copy shifted half a limb. */
hp = tp; /* (dn + 1) limbs */
- cy = mpn_lshift (hp, dp, dn, GMP_NUMB_BITS / 2);
- hp[dn] = dp[dn - 1] >> GMP_NUMB_BITS / 2;
+ hp[dn] = mpn_lshift (hp, dp, dn, GMP_NUMB_BITS / 2);
#if OPERATION_sbpi1_div_qr_sec
qlp = tp + (dn + 1); /* (nn - dn) limbs */
qhp = tp + (nn + 1); /* (nn - dn) limbs */
#endif
- np += nn;
+ np += nn - dn;
+ nh = 0;
- /* Main loop. Develop one full limb per iteration, but do it in two steps in
- order to avoid conditionals. Quotient bits will be either correct or
- underestimates. When a quotient is underestimated, the next quotient will
- compensate, since quotients are to be added at consecutive weight distance
- GMP_NUMB_BITS/2. We make two quotient arrays, each with GMP_NUMB_BITS/2+2
- bits per entry. The arrays are added late after the loop. Separate
- arrays avoid data-dependent carry propagation. */
- nh = 0;
for (i = nn - dn - 1; i >= 0; i--)
{
np--;
- nh = (nh << GMP_NUMB_BITS/2) + (np[0] >> GMP_NUMB_BITS/2);
+ nh = (nh << GMP_NUMB_BITS/2) + (np[dn] >> GMP_NUMB_BITS/2);
umul_ppmm (q1h, dummy, nh, dinv);
q1h += nh;
#if OPERATION_sbpi1_div_qr_sec
qhp[i] = q1h;
#endif
- cy = mpn_submul_1 (np - dn, hp, dn + 1, q1h);
+ mpn_submul_1 (np, hp, dn + 1, q1h);
- nh = np[0];
+ nh = np[dn];
umul_ppmm (q0h, dummy, nh, dinv);
q0h += nh;
#if OPERATION_sbpi1_div_qr_sec
qlp[i] = q0h;
#endif
- cy = mpn_submul_1 (np - dn, dp, dn, q0h);
-
- nh -= cy;
+ nh -= mpn_submul_1 (np, dp, dn, q0h);
}
- np[0] = nh;
-
- np -= dn;
-
/* 1st adjustment depends on extra high remainder limb. */
- h = np[dn];
+ cnd = nh != 0; /* FIXME: cmp-to-int */
#if OPERATION_sbpi1_div_qr_sec
- qlp[0] += h;
+ qlp[0] += cnd;
#endif
- h -= mpn_subcnd_n (np, np, dp, dn, h);
+ nh -= mpn_subcnd_n (np, np, dp, dn, cnd);
- /* 2nd adjustment depends on remainder/divisor comparision as well as whether
+ /* 2nd adjustment depends on remainder/divisor comparison as well as whether
extra remainder limb was nullified by previous subtract. */
cy = mpn_sub_n (np, np, dp, dn);
- cy = cy == h; /* FIXME: might leak on some archs */
+ cy = cy - nh;
#if OPERATION_sbpi1_div_qr_sec
- qlp[0] += cy;
+ qlp[0] += 1 - cy;
#endif
- mpn_addcnd_n (np, np, dp, dn, 1 - cy);
+ mpn_addcnd_n (np, np, dp, dn, cy);
+ /* 3rd adjustment depends on remainder/divisor comparison. */
+ cy = mpn_sub_n (np, np, dp, dn);
+#if OPERATION_sbpi1_div_qr_sec
+ qlp[0] += 1 - cy;
+#endif
+ mpn_addcnd_n (np, np, dp, dn, cy);
+
+#if OPERATION_sbpi1_div_qr_sec
/* Combine quotient halves into final quotient. */
-#if OPERATION_sbpi1_div_qr_sec
- qh = 0;
- if (nn - dn != 0)
- {
- qh = mpn_lshift (qhp, qhp, nn - dn, GMP_NUMB_BITS/2);
- qh += mpn_add_n (qp, qhp, qlp, nn - dn);
- }
+ qh = mpn_lshift (qhp, qhp, nn - dn, GMP_NUMB_BITS/2);
+ qh += mpn_add_n (qp, qhp, qlp, nn - dn);
return qh;
#else

View File

@ -1,73 +0,0 @@
# HG changeset patch
# User Torbjorn Granlund <tege@gmplib.org>
# Date 1369216954 -7200
# Node ID 394bdf8fdaee749660cc5680cc0636ea0242fae7
# Parent 0771124b9f13b218a3f07f7dd7c127961974489d
Don't clobber f16-f18.
diff -r 0771124b9f13 -r 394bdf8fdaee mpn/ia64/divrem_2.asm
--- a/mpn/ia64/divrem_2.asm Mon May 20 16:56:05 2013 +0200
+++ b/mpn/ia64/divrem_2.asm Wed May 22 12:02:34 2013 +0200
@@ -1,6 +1,6 @@
dnl IA-64 mpn_divrem_2 -- Divide an mpn number by a normalized 2-limb number.
-dnl Copyright 2010 Free Software Foundation, Inc.
+dnl Copyright 2010, 2013 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
@@ -98,17 +98,17 @@
br.call.sptk.many b0 = mpn_invert_limb
;;
setf.sig f11 = r8 // di (non-final)
- setf.sig f18 = r39 // d1
- setf.sig f17 = r36 // d0
+ setf.sig f34 = r39 // d1
+ setf.sig f33 = r36 // d0
mov r1 = r43
;;
mov r17 = 1
setf.sig f9 = r38 // n2
- xma.l f6 = f11, f18, f0 // t0 = LO(di * d1)
+ xma.l f6 = f11, f34, f0 // t0 = LO(di * d1)
;;
setf.sig f10 = r37 // n1
setf.sig f15 = r17 // 1
- xma.hu f8 = f11, f17, f0 // s0 = HI(di * d0)
+ xma.hu f8 = f11, f33, f0 // s0 = HI(di * d0)
;;
getf.sig r17 = f6
getf.sig r16 = f8
@@ -178,7 +178,7 @@
(p9) br.cond.dptk .L52
.L46:
')
- setf.sig f16 = r8 // di
+ setf.sig f32 = r8 // di
shladd r32 = r35, 3, r32
;;
@@ -189,8 +189,8 @@
;;
(p8) mov r37 = r0
(p9) ld8 r37 = [r34], -8
- xma.hu f8 = f9, f16, f10 // 0,29
- xma.l f12 = f9, f16, f10 // 0
+ xma.hu f8 = f9, f32, f10 // 0,29
+ xma.l f12 = f9, f32, f10 // 0
;;
getf.sig r20 = f12 // q0 4
xma.l f13 = f15, f8, f9 // q += n2 4
@@ -198,8 +198,8 @@
;;
getf.sig r18 = f13 // 8
xma.l f7 = f14, f13, f10 // 8
- xma.l f6 = f17, f13, f17 // t0 = LO(d0*q+d0) 8
- xma.hu f9 = f17, f13, f17 // t1 = HI(d0*q+d0) 9
+ xma.l f6 = f33, f13, f33 // t0 = LO(d0*q+d0) 8
+ xma.hu f9 = f33, f13, f33 // t1 = HI(d0*q+d0) 9
;;
getf.sig r38 = f7 // n1 12
getf.sig r16 = f6 // 13

View File

@ -1 +0,0 @@
obsolete='yes'

View File

@ -1,59 +0,0 @@
# HG changeset patch
# User Torbjorn Granlund <torbjorng@google.com>
# Date 1450109109 -3600
# Node ID 67d4ee9dead1ed8b1c9f4eb320ac72208fe1a015
# Parent 20bf21d5f600710d62b040ea9b20da22871db1f1
Add FUNC_EXITs.
diff -r 20bf21d5f600 -r 67d4ee9dead1 NEWS
--- a/NEWS Mon Dec 14 08:37:18 2015 +0100
+++ b/NEWS Mon Dec 14 17:05:09 2015 +0100
@@ -4,6 +4,11 @@
medium, provided this notice is preserved.
+Changes between GMP version 6.1.1 and 6.1.0
+
+ BUGS FIXED
+ * .
+
Changes between GMP version 6.0.* and 6.1.0
BUGS FIXED
diff -r 20bf21d5f600 -r 67d4ee9dead1 mpn/x86_64/coreibwl/mul_basecase.asm
--- a/mpn/x86_64/coreibwl/mul_basecase.asm Mon Dec 14 08:37:18 2015 +0100
+++ b/mpn/x86_64/coreibwl/mul_basecase.asm Mon Dec 14 17:05:09 2015 +0100
@@ -94,6 +94,7 @@
L(s11): mov %rax, (rp)
mov %r9, 8(rp)
+ FUNC_EXIT()
ret
L(s2x): cmp $2, vn
@@ -105,6 +106,7 @@
mov %rax, (rp)
mov %r9, 8(rp)
mov %r10, 16(rp)
+ FUNC_EXIT()
ret
L(s22): add %r8, %r9 C 1
@@ -121,6 +123,7 @@
mov %r9, 8(rp)
mov %r10, 16(rp)
mov %rdx, 24(rp)
+ FUNC_EXIT()
ret
ALIGN(16)
@@ -294,6 +297,7 @@
pop %r12
pop %rbp
pop %rbx
+ FUNC_EXIT()
ret
L(f2):

View File

@ -1 +0,0 @@
obsolete='yes'

View File

@ -1,24 +0,0 @@
diff -dur libelf-0.8.10.orig/configure libelf-0.8.10/configure
--- libelf-0.8.10.orig/configure 2007-09-07 14:08:06.000000000 +0200
+++ libelf-0.8.10/configure 2008-10-23 22:43:19.000000000 +0200
@@ -1595,7 +1595,7 @@
echo $ac_n "(cached) $ac_c" 1>&6
else
if test "$cross_compiling" = yes; then
- ac_cv_sizeof_long_long=0
+ ac_cv_sizeof_long_long=8
else
cat > conftest.$ac_ext <<EOF
#line 1602 "configure"
diff -dur libelf-0.8.10.orig/configure.in libelf-0.8.10/configure.in
--- libelf-0.8.10.orig/configure.in 2007-09-07 14:07:59.000000000 +0200
+++ libelf-0.8.10/configure.in 2008-10-23 22:43:10.000000000 +0200
@@ -90,7 +90,7 @@
AC_CHECK_SIZEOF(short,2)
AC_CHECK_SIZEOF(int,4)
AC_CHECK_SIZEOF(long,4)
-AC_CHECK_SIZEOF(long long,0)
+AC_CHECK_SIZEOF(long long,8)
# Windows port
AC_CHECK_SIZEOF(__int64, 0)

View File

@ -1 +0,0 @@
obsolete='yes'

View File

@ -1 +0,0 @@
obsolete='yes'

View File

@ -1 +0,0 @@
obsolete='yes'

View File

@ -1,27 +0,0 @@
diff -urpN mingw-w64-v5.0.1.orig/mingw-w64-tools/genidl/src/genidl_cfg.h mingw-w64-v5.0.1/mingw-w64-tools/genidl/src/genidl_cfg.h
--- mingw-w64-v5.0.1.orig/mingw-w64-tools/genidl/src/genidl_cfg.h 2017-03-10 16:20:09.000000000 -0800
+++ mingw-w64-v5.0.1/mingw-w64-tools/genidl/src/genidl_cfg.h 2017-03-10 16:25:26.000000000 -0800
@@ -26,7 +26,9 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#if defined(HAVE_MALLOC_H)
#include <malloc.h>
+#endif
#include <memory.h>
#include <stdarg.h>
#include <stdint.h>
diff -urpN mingw-w64-v5.0.1.orig/mingw-w64-tools/genidl/src/genidl_typinfo.c mingw-w64-v5.0.1/mingw-w64-tools/genidl/src/genidl_typinfo.c
--- mingw-w64-v5.0.1.orig/mingw-w64-tools/genidl/src/genidl_typinfo.c 2017-03-10 16:20:09.000000000 -0800
+++ mingw-w64-v5.0.1/mingw-w64-tools/genidl/src/genidl_typinfo.c 2017-03-10 16:25:49.000000000 -0800
@@ -21,7 +21,10 @@
#include "genidl_cfg.h"
#include "genidl_typeinfo.h"
#include "genidl_typinfo.h"
+#if defined(HAVE_MALLOC_H)
#include <malloc.h>
+#endif
+#include <stdlib.h>
#include <string.h>
#include <memory.h>

View File

@ -1 +0,0 @@
obsolete='yes'

View File

@ -1,27 +0,0 @@
diff -urpN mingw-w64-v5.0.1.orig/mingw-w64-tools/genidl/src/genidl_cfg.h mingw-w64-v5.0.1/mingw-w64-tools/genidl/src/genidl_cfg.h
--- mingw-w64-v5.0.1.orig/mingw-w64-tools/genidl/src/genidl_cfg.h 2017-03-10 16:20:09.000000000 -0800
+++ mingw-w64-v5.0.1/mingw-w64-tools/genidl/src/genidl_cfg.h 2017-03-10 16:25:26.000000000 -0800
@@ -26,7 +26,9 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#if defined(HAVE_MALLOC_H)
#include <malloc.h>
+#endif
#include <memory.h>
#include <stdarg.h>
#include <stdint.h>
diff -urpN mingw-w64-v5.0.1.orig/mingw-w64-tools/genidl/src/genidl_typinfo.c mingw-w64-v5.0.1/mingw-w64-tools/genidl/src/genidl_typinfo.c
--- mingw-w64-v5.0.1.orig/mingw-w64-tools/genidl/src/genidl_typinfo.c 2017-03-10 16:20:09.000000000 -0800
+++ mingw-w64-v5.0.1/mingw-w64-tools/genidl/src/genidl_typinfo.c 2017-03-10 16:25:49.000000000 -0800
@@ -21,7 +21,10 @@
#include "genidl_cfg.h"
#include "genidl_typeinfo.h"
#include "genidl_typinfo.h"
+#if defined(HAVE_MALLOC_H)
#include <malloc.h>
+#endif
+#include <stdlib.h>
#include <string.h>
#include <memory.h>

View File

@ -1 +0,0 @@
obsolete='yes'

View File

@ -1,27 +0,0 @@
diff -urpN mingw-w64-v5.0.1.orig/mingw-w64-tools/genidl/src/genidl_cfg.h mingw-w64-v5.0.1/mingw-w64-tools/genidl/src/genidl_cfg.h
--- mingw-w64-v5.0.1.orig/mingw-w64-tools/genidl/src/genidl_cfg.h 2017-03-10 16:20:09.000000000 -0800
+++ mingw-w64-v5.0.1/mingw-w64-tools/genidl/src/genidl_cfg.h 2017-03-10 16:25:26.000000000 -0800
@@ -26,7 +26,9 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#if defined(HAVE_MALLOC_H)
#include <malloc.h>
+#endif
#include <memory.h>
#include <stdarg.h>
#include <stdint.h>
diff -urpN mingw-w64-v5.0.1.orig/mingw-w64-tools/genidl/src/genidl_typinfo.c mingw-w64-v5.0.1/mingw-w64-tools/genidl/src/genidl_typinfo.c
--- mingw-w64-v5.0.1.orig/mingw-w64-tools/genidl/src/genidl_typinfo.c 2017-03-10 16:20:09.000000000 -0800
+++ mingw-w64-v5.0.1/mingw-w64-tools/genidl/src/genidl_typinfo.c 2017-03-10 16:25:49.000000000 -0800
@@ -21,7 +21,10 @@
#include "genidl_cfg.h"
#include "genidl_typeinfo.h"
#include "genidl_typinfo.h"
+#if defined(HAVE_MALLOC_H)
#include <malloc.h>
+#endif
+#include <stdlib.h>
#include <string.h>
#include <memory.h>

View File

@ -1 +0,0 @@
obsolete='yes'

View File

@ -1,27 +0,0 @@
diff -urpN mingw-w64-v5.0.1.orig/mingw-w64-tools/genidl/src/genidl_cfg.h mingw-w64-v5.0.1/mingw-w64-tools/genidl/src/genidl_cfg.h
--- mingw-w64-v5.0.1.orig/mingw-w64-tools/genidl/src/genidl_cfg.h 2017-03-10 16:20:09.000000000 -0800
+++ mingw-w64-v5.0.1/mingw-w64-tools/genidl/src/genidl_cfg.h 2017-03-10 16:25:26.000000000 -0800
@@ -26,7 +26,9 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#if defined(HAVE_MALLOC_H)
#include <malloc.h>
+#endif
#include <memory.h>
#include <stdarg.h>
#include <stdint.h>
diff -urpN mingw-w64-v5.0.1.orig/mingw-w64-tools/genidl/src/genidl_typinfo.c mingw-w64-v5.0.1/mingw-w64-tools/genidl/src/genidl_typinfo.c
--- mingw-w64-v5.0.1.orig/mingw-w64-tools/genidl/src/genidl_typinfo.c 2017-03-10 16:20:09.000000000 -0800
+++ mingw-w64-v5.0.1/mingw-w64-tools/genidl/src/genidl_typinfo.c 2017-03-10 16:25:49.000000000 -0800
@@ -21,7 +21,10 @@
#include "genidl_cfg.h"
#include "genidl_typeinfo.h"
#include "genidl_typinfo.h"
+#if defined(HAVE_MALLOC_H)
#include <malloc.h>
+#endif
+#include <stdlib.h>
#include <string.h>
#include <memory.h>

View File

@ -1 +0,0 @@
obsolete='yes'

View File

@ -1,27 +0,0 @@
diff -urpN mingw-w64-v5.0.1.orig/mingw-w64-tools/genidl/src/genidl_cfg.h mingw-w64-v5.0.1/mingw-w64-tools/genidl/src/genidl_cfg.h
--- mingw-w64-v5.0.1.orig/mingw-w64-tools/genidl/src/genidl_cfg.h 2017-03-10 16:20:09.000000000 -0800
+++ mingw-w64-v5.0.1/mingw-w64-tools/genidl/src/genidl_cfg.h 2017-03-10 16:25:26.000000000 -0800
@@ -26,7 +26,9 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#if defined(HAVE_MALLOC_H)
#include <malloc.h>
+#endif
#include <memory.h>
#include <stdarg.h>
#include <stdint.h>
diff -urpN mingw-w64-v5.0.1.orig/mingw-w64-tools/genidl/src/genidl_typinfo.c mingw-w64-v5.0.1/mingw-w64-tools/genidl/src/genidl_typinfo.c
--- mingw-w64-v5.0.1.orig/mingw-w64-tools/genidl/src/genidl_typinfo.c 2017-03-10 16:20:09.000000000 -0800
+++ mingw-w64-v5.0.1/mingw-w64-tools/genidl/src/genidl_typinfo.c 2017-03-10 16:25:49.000000000 -0800
@@ -21,7 +21,10 @@
#include "genidl_cfg.h"
#include "genidl_typeinfo.h"
#include "genidl_typinfo.h"
+#if defined(HAVE_MALLOC_H)
#include <malloc.h>
+#endif
+#include <stdlib.h>
#include <string.h>
#include <memory.h>

View File

@ -1 +0,0 @@
obsolete='yes'

View File

@ -1,27 +0,0 @@
diff -urpN mingw-w64-v5.0.1.orig/mingw-w64-tools/genidl/src/genidl_cfg.h mingw-w64-v5.0.1/mingw-w64-tools/genidl/src/genidl_cfg.h
--- mingw-w64-v5.0.1.orig/mingw-w64-tools/genidl/src/genidl_cfg.h 2017-03-10 16:20:09.000000000 -0800
+++ mingw-w64-v5.0.1/mingw-w64-tools/genidl/src/genidl_cfg.h 2017-03-10 16:25:26.000000000 -0800
@@ -26,7 +26,9 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#if defined(HAVE_MALLOC_H)
#include <malloc.h>
+#endif
#include <memory.h>
#include <stdarg.h>
#include <stdint.h>
diff -urpN mingw-w64-v5.0.1.orig/mingw-w64-tools/genidl/src/genidl_typinfo.c mingw-w64-v5.0.1/mingw-w64-tools/genidl/src/genidl_typinfo.c
--- mingw-w64-v5.0.1.orig/mingw-w64-tools/genidl/src/genidl_typinfo.c 2017-03-10 16:20:09.000000000 -0800
+++ mingw-w64-v5.0.1/mingw-w64-tools/genidl/src/genidl_typinfo.c 2017-03-10 16:25:49.000000000 -0800
@@ -21,7 +21,10 @@
#include "genidl_cfg.h"
#include "genidl_typeinfo.h"
#include "genidl_typinfo.h"
+#if defined(HAVE_MALLOC_H)
#include <malloc.h>
+#endif
+#include <stdlib.h>
#include <string.h>
#include <memory.h>

View File

@ -1 +0,0 @@
obsolete='yes'

View File

@ -1,27 +0,0 @@
diff -urpN mingw-w64-v5.0.1.orig/mingw-w64-tools/genidl/src/genidl_cfg.h mingw-w64-v5.0.1/mingw-w64-tools/genidl/src/genidl_cfg.h
--- mingw-w64-v5.0.1.orig/mingw-w64-tools/genidl/src/genidl_cfg.h 2017-03-10 16:20:09.000000000 -0800
+++ mingw-w64-v5.0.1/mingw-w64-tools/genidl/src/genidl_cfg.h 2017-03-10 16:25:26.000000000 -0800
@@ -26,7 +26,9 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#if defined(HAVE_MALLOC_H)
#include <malloc.h>
+#endif
#include <memory.h>
#include <stdarg.h>
#include <stdint.h>
diff -urpN mingw-w64-v5.0.1.orig/mingw-w64-tools/genidl/src/genidl_typinfo.c mingw-w64-v5.0.1/mingw-w64-tools/genidl/src/genidl_typinfo.c
--- mingw-w64-v5.0.1.orig/mingw-w64-tools/genidl/src/genidl_typinfo.c 2017-03-10 16:20:09.000000000 -0800
+++ mingw-w64-v5.0.1/mingw-w64-tools/genidl/src/genidl_typinfo.c 2017-03-10 16:25:49.000000000 -0800
@@ -21,7 +21,10 @@
#include "genidl_cfg.h"
#include "genidl_typeinfo.h"
#include "genidl_typinfo.h"
+#if defined(HAVE_MALLOC_H)
#include <malloc.h>
+#endif
+#include <stdlib.h>
#include <string.h>
#include <memory.h>

View File

@ -1 +0,0 @@
obsolete='yes'

View File

@ -1,55 +0,0 @@
diff -urpN mingw-w64-v5.0.1.orig/mingw-w64-tools/genidl/src/genidl_cfg.h mingw-w64-v5.0.1/mingw-w64-tools/genidl/src/genidl_cfg.h
--- mingw-w64-v5.0.1.orig/mingw-w64-tools/genidl/src/genidl_cfg.h 2017-03-10 16:20:09.000000000 -0800
+++ mingw-w64-v5.0.1/mingw-w64-tools/genidl/src/genidl_cfg.h 2017-03-10 16:25:26.000000000 -0800
@@ -26,7 +26,9 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#if defined(HAVE_MALLOC_H)
#include <malloc.h>
+#endif
#include <memory.h>
#include <stdarg.h>
#include <stdint.h>
diff -urpN mingw-w64-v5.0.1.orig/mingw-w64-tools/genidl/src/genidl_typinfo.c mingw-w64-v5.0.1/mingw-w64-tools/genidl/src/genidl_typinfo.c
--- mingw-w64-v5.0.1.orig/mingw-w64-tools/genidl/src/genidl_typinfo.c 2017-03-10 16:20:09.000000000 -0800
+++ mingw-w64-v5.0.1/mingw-w64-tools/genidl/src/genidl_typinfo.c 2017-03-10 16:25:49.000000000 -0800
@@ -21,7 +21,10 @@
#include "genidl_cfg.h"
#include "genidl_typeinfo.h"
#include "genidl_typinfo.h"
+#if defined(HAVE_MALLOC_H)
#include <malloc.h>
+#endif
+#include <stdlib.h>
#include <string.h>
#include <memory.h>
diff -urpN mingw-w64-v5.0.1.orig/mingw-w64-tools/widl/include/pathtools.h mingw-w64-v5.0.1/mingw-w64-tools/widl/include/pathtools.h
--- mingw-w64-v5.0.1.orig/mingw-w64-tools/widl/include/pathtools.h 2017-03-10 16:20:09.000000000 -0800
+++ mingw-w64-v5.0.1/mingw-w64-tools/widl/include/pathtools.h 2017-03-10 16:26:21.000000000 -0800
@@ -12,9 +12,8 @@
#define PATHTOOLS_H
#include <unistd.h>
-#if defined(__APPLE__)
#include <stdlib.h>
-#else
+#if defined(HAVE_MALLOC_H)
#include <malloc.h>
#endif
#include <stdio.h>
diff -urpN mingw-w64-v5.0.1.orig/mingw-w64-tools/widl/src/pathtools.c mingw-w64-v5.0.1/mingw-w64-tools/widl/src/pathtools.c
--- mingw-w64-v5.0.1.orig/mingw-w64-tools/widl/src/pathtools.c 2017-03-10 16:20:09.000000000 -0800
+++ mingw-w64-v5.0.1/mingw-w64-tools/widl/src/pathtools.c 2017-03-10 16:26:40.000000000 -0800
@@ -8,9 +8,8 @@
.email: <mingw.android@gmail.com>.
*/
-#if defined(__APPLE__)
#include <stdlib.h>
-#else
+#if defined(HAVE_MALLOC_H)
#include <malloc.h>
#endif
#include <limits.h>

View File

@ -1 +0,0 @@
obsolete='yes'

View File

@ -1,55 +0,0 @@
diff -urpN mingw-w64-v5.0.1.orig/mingw-w64-tools/genidl/src/genidl_cfg.h mingw-w64-v5.0.1/mingw-w64-tools/genidl/src/genidl_cfg.h
--- mingw-w64-v5.0.1.orig/mingw-w64-tools/genidl/src/genidl_cfg.h 2017-03-10 16:20:09.000000000 -0800
+++ mingw-w64-v5.0.1/mingw-w64-tools/genidl/src/genidl_cfg.h 2017-03-10 16:25:26.000000000 -0800
@@ -26,7 +26,9 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#if defined(HAVE_MALLOC_H)
#include <malloc.h>
+#endif
#include <memory.h>
#include <stdarg.h>
#include <stdint.h>
diff -urpN mingw-w64-v5.0.1.orig/mingw-w64-tools/genidl/src/genidl_typinfo.c mingw-w64-v5.0.1/mingw-w64-tools/genidl/src/genidl_typinfo.c
--- mingw-w64-v5.0.1.orig/mingw-w64-tools/genidl/src/genidl_typinfo.c 2017-03-10 16:20:09.000000000 -0800
+++ mingw-w64-v5.0.1/mingw-w64-tools/genidl/src/genidl_typinfo.c 2017-03-10 16:25:49.000000000 -0800
@@ -21,7 +21,10 @@
#include "genidl_cfg.h"
#include "genidl_typeinfo.h"
#include "genidl_typinfo.h"
+#if defined(HAVE_MALLOC_H)
#include <malloc.h>
+#endif
+#include <stdlib.h>
#include <string.h>
#include <memory.h>
diff -urpN mingw-w64-v5.0.1.orig/mingw-w64-tools/widl/include/pathtools.h mingw-w64-v5.0.1/mingw-w64-tools/widl/include/pathtools.h
--- mingw-w64-v5.0.1.orig/mingw-w64-tools/widl/include/pathtools.h 2017-03-10 16:20:09.000000000 -0800
+++ mingw-w64-v5.0.1/mingw-w64-tools/widl/include/pathtools.h 2017-03-10 16:26:21.000000000 -0800
@@ -12,9 +12,8 @@
#define PATHTOOLS_H
#include <unistd.h>
-#if defined(__APPLE__)
#include <stdlib.h>
-#else
+#if defined(HAVE_MALLOC_H)
#include <malloc.h>
#endif
#include <stdio.h>
diff -urpN mingw-w64-v5.0.1.orig/mingw-w64-tools/widl/src/pathtools.c mingw-w64-v5.0.1/mingw-w64-tools/widl/src/pathtools.c
--- mingw-w64-v5.0.1.orig/mingw-w64-tools/widl/src/pathtools.c 2017-03-10 16:20:09.000000000 -0800
+++ mingw-w64-v5.0.1/mingw-w64-tools/widl/src/pathtools.c 2017-03-10 16:26:40.000000000 -0800
@@ -8,9 +8,8 @@
.email: <mingw.android@gmail.com>.
*/
-#if defined(__APPLE__)
#include <stdlib.h>
-#else
+#if defined(HAVE_MALLOC_H)
#include <malloc.h>
#endif
#include <limits.h>

View File

@ -1,14 +0,0 @@
--- trunk/src/acos.c 2009/12/08 16:49:43 733
+++ trunk/src/acos.c 2009/12/09 20:51:38 734
@@ -188,10 +188,7 @@
else
rnd_im = rnd_im == GMP_RNDU ? GMP_RNDD
: rnd_im == GMP_RNDD ? GMP_RNDU
-#if MPFR_VERSION_MAJOR >= 3
- : rnd_im == GMP_RNDA ? GMP_RNDZ
-#endif
- : rnd_im;
+ : rnd_im; /* both RNDZ and RNDA map to themselves for -asin(z) */
rnd1 = RNDC(GMP_RNDN, rnd_im);
mpfr_init2 (pi_over_2, p);
for (;;)

View File

@ -1 +0,0 @@
obsolete='yes'

View File

@ -1 +0,0 @@
obsolete='yes'

View File

@ -1 +0,0 @@
obsolete='yes'

View File

@ -1 +0,0 @@
obsolete='yes'

View File

@ -1,359 +0,0 @@
diff -Naurd mpfr-2.4.0-a/PATCHES mpfr-2.4.0-b/PATCHES
--- mpfr-2.4.0-a/PATCHES 2009-01-26 12:52:01.000000000 +0000
+++ mpfr-2.4.0-b/PATCHES 2009-02-20 17:27:44.000000000 +0000
@@ -0,0 +1 @@
+printf-hh-ll
diff -Naurd mpfr-2.4.0-a/VERSION mpfr-2.4.0-b/VERSION
--- mpfr-2.4.0-a/VERSION 2009-01-26 12:52:01.000000000 +0000
+++ mpfr-2.4.0-b/VERSION 2009-02-20 17:27:44.000000000 +0000
@@ -1 +1 @@
-2.4.0
+2.4.0-p1
diff -Naurd mpfr-2.4.0-a/acinclude.m4 mpfr-2.4.0-b/acinclude.m4
--- mpfr-2.4.0-a/acinclude.m4 2009-01-26 12:52:01.000000000 +0000
+++ mpfr-2.4.0-b/acinclude.m4 2009-01-26 12:52:01.000000000 +0000
@@ -722,6 +722,16 @@
[AC_DEFINE([NPRINTF_J], 1, [gmp_printf cannot read intmax_t])])
fi
+MPFR_FUNC_PRINTF_SPEC([%hhd], [char], [
+#include <gmp.h>
+ ], [gmp_],,
+ [AC_DEFINE([NPRINTF_HH], 1, [gmp_printf cannot use 'hh' length modifier])])
+
+MPFR_FUNC_PRINTF_SPEC([%lld], [long long int], [
+#include <gmp.h>
+ ], [gmp_],,
+ [AC_DEFINE([NPRINTF_LL], 1, [gmp_printf cannot read long long int])])
+
MPFR_FUNC_PRINTF_SPEC([%.0Lf], [long double], [
#include <gmp.h>
], [gmp_],,
diff -Naurd mpfr-2.4.0-a/configure mpfr-2.4.0-b/configure
--- mpfr-2.4.0-a/configure 2009-01-26 12:54:36.000000000 +0000
+++ mpfr-2.4.0-b/configure 2009-02-20 17:38:36.000000000 +0000
@@ -24874,6 +24874,170 @@
fi
+{ $as_echo "$as_me:$LINENO: checking if gmp_printf supports \"%hhd\"" >&5
+$as_echo_n "checking if gmp_printf supports \"%hhd\"... " >&6; }
+if test "$cross_compiling" = yes; then
+ { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { $as_echo "$as_me:$LINENO: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&5
+$as_echo "$as_me: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }; }
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+#include <stdio.h>
+
+#include <gmp.h>
+
+
+int
+main ()
+{
+
+ char s[256];
+ char a = 0;
+ return (gmp_sprintf (s, "%hhd", a) != 1) ? 1 : 0;
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
+
+else
+ $as_echo "$as_me: program exited with status $ac_status" >&5
+$as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+{ $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+
+cat >>confdefs.h <<\_ACEOF
+#define NPRINTF_HH 1
+_ACEOF
+
+fi
+rm -rf conftest.dSYM
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+
+
+
+{ $as_echo "$as_me:$LINENO: checking if gmp_printf supports \"%lld\"" >&5
+$as_echo_n "checking if gmp_printf supports \"%lld\"... " >&6; }
+if test "$cross_compiling" = yes; then
+ { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { $as_echo "$as_me:$LINENO: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&5
+$as_echo "$as_me: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }; }
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+#include <stdio.h>
+
+#include <gmp.h>
+
+
+int
+main ()
+{
+
+ char s[256];
+ long long int a = 0;
+ return (gmp_sprintf (s, "%lld", a) != 1) ? 1 : 0;
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
+
+else
+ $as_echo "$as_me: program exited with status $ac_status" >&5
+$as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+{ $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+
+cat >>confdefs.h <<\_ACEOF
+#define NPRINTF_LL 1
+_ACEOF
+
+fi
+rm -rf conftest.dSYM
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+
+
+
{ $as_echo "$as_me:$LINENO: checking if gmp_printf supports \"%.0Lf\"" >&5
$as_echo_n "checking if gmp_printf supports \"%.0Lf\"... " >&6; }
if test "$cross_compiling" = yes; then
diff -Naurd mpfr-2.4.0-a/mpfr.h mpfr-2.4.0-b/mpfr.h
--- mpfr-2.4.0-a/mpfr.h 2009-01-26 12:52:01.000000000 +0000
+++ mpfr-2.4.0-b/mpfr.h 2009-02-20 17:27:44.000000000 +0000
@@ -27,7 +27,7 @@
#define MPFR_VERSION_MAJOR 2
#define MPFR_VERSION_MINOR 4
#define MPFR_VERSION_PATCHLEVEL 0
-#define MPFR_VERSION_STRING "2.4.0"
+#define MPFR_VERSION_STRING "2.4.0-p1"
/* Macros dealing with MPFR VERSION */
#define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
diff -Naurd mpfr-2.4.0-a/tests/tfprintf.c mpfr-2.4.0-b/tests/tfprintf.c
--- mpfr-2.4.0-a/tests/tfprintf.c 2009-01-26 12:52:00.000000000 +0000
+++ mpfr-2.4.0-b/tests/tfprintf.c 2009-02-20 16:31:02.000000000 +0000
@@ -146,6 +146,7 @@
short sh = -1;
unsigned short ush = 1;
int i = -1;
+ int j = 1;
unsigned int ui = 1;
long lo = -1;
unsigned long ulo = 1;
@@ -179,12 +180,11 @@
limb[0] = limb[1] = limb[2] = ~ (mp_limb_t) 0;
- check_vfprintf (fout, "a. %Ra, b. %hhu, c. %u, d. %lx%hhn", mpfr, uch, ui,
- ulo, &uch);
- check_length (1, uch, 28, hhu);
- check_vfprintf (fout, "a. %hhi, b. %Rb, c. %u, d. %li%ln", sch, mpfr, i,
+ check_vfprintf (fout, "a. %Ra, b. %u, c. %lx%n", mpfr, ui, ulo, &j);
+ check_length (1, j, 22, d);
+ check_vfprintf (fout, "a. %c, b. %Rb, c. %u, d. %li%ln", i, mpfr, i,
lo, &ulo);
- check_length (2, ulo, 37, lu);
+ check_length (2, ulo, 36, lu);
check_vfprintf (fout, "a. %hi, b. %*f, c. %Re%hn", ush, 3, f, mpfr, &ush);
check_length (3, ush, 29, hu);
check_vfprintf (fout, "a. %hi, b. %f, c. %#.2Rf%n", sh, d, mpfr, &i);
@@ -208,13 +208,18 @@
check_length (9, sz, 30, zu);
#endif
+#ifndef NPRINTF_HH
+ check_vfprintf (fout, "a. %hhi, b.%RA, c. %hhu%hhn", sch, mpfr, uch, &uch);
+ check_length (10, uch, 21, hhu);
+#endif
+
#if (__GNU_MP_VERSION * 10 + __GNU_MP_VERSION_MINOR) >= 42
/* The 'M' specifier was added in gmp 4.2.0 */
check_vfprintf (fout, "a. %Mx b. %Re%Mn", limb[0], mpfr, &limb[0]);
if (limb[0] != 14 + BITS_PER_MP_LIMB / 4 || limb[1] != ~ (mp_limb_t) 0
|| limb[2] != ~ (mp_limb_t) 0)
{
- printf ("Error in test #10: mpfr_vfprintf did not print %d characters"
+ printf ("Error in test #11: mpfr_vfprintf did not print %d characters"
" as expected\n", 14 + (int) BITS_PER_MP_LIMB / 4);
exit (1);
}
@@ -227,13 +232,13 @@
if (limb[0] != 14 + 3 * BITS_PER_MP_LIMB / 4 || limb[1] != (mp_limb_t) 0
|| limb[2] != ~ (mp_limb_t) 0)
{
- printf ("Error in test #11: mpfr_vfprintf did not print %d characters"
+ printf ("Error in test #12: mpfr_vfprintf did not print %d characters"
" as expected\n", 14 + (int) BITS_PER_MP_LIMB / 4);
exit (1);
}
#endif
-#ifdef HAVE_LONG_LONG
+#if defined(HAVE_LONG_LONG) && !defined(NPRINTF_LL)
{
long long llo = -1;
unsigned long long ullo = 1;
diff -Naurd mpfr-2.4.0-a/tests/tprintf.c mpfr-2.4.0-b/tests/tprintf.c
--- mpfr-2.4.0-a/tests/tprintf.c 2009-01-26 12:52:00.000000000 +0000
+++ mpfr-2.4.0-b/tests/tprintf.c 2009-02-20 16:31:02.000000000 +0000
@@ -150,6 +150,7 @@
short sh = -1;
unsigned short ush = 1;
int i = -1;
+ int j = 1;
unsigned int ui = 1;
long lo = -1;
unsigned long ulo = 1;
@@ -178,11 +179,10 @@
mpfr_set_f (mpfr, mpf, GMP_RNDN);
prec = mpfr_get_prec (mpfr);
- check_vprintf ("a. %Ra, b. %hhu, c. %u, d. %lx%hhn", mpfr, uch, ui, ulo,
- &uch);
- check_length (1, uch, 28, hhu);
- check_vprintf ("a. %hhi, b. %Rb, c. %u, d. %li%ln", sch, mpfr, i, lo, &ulo);
- check_length (2, ulo, 37, lu);
+ check_vprintf ("a. %Ra, b. %u, c. %lx%n", mpfr, ui, ulo, &j);
+ check_length (1, j, 22, d);
+ check_vprintf ("a. %c, b. %Rb, c. %u, d. %li%ln", i, mpfr, i, lo, &ulo);
+ check_length (2, ulo, 36, lu);
check_vprintf ("a. %hi, b. %*f, c. %Re%hn", ush, 3, f, mpfr, &ush);
check_length (3, ush, 29, hu);
check_vprintf ("a. %hi, b. %f, c. %#.2Rf%n", sh, d, mpfr, &i);
@@ -204,7 +204,12 @@
check_length (9, sz, 30, zu);
#endif
-#ifdef HAVE_LONG_LONG
+#ifndef NPRINTF_HH
+ check_vprintf ("a. %hhi, b. %Ra, c. %hhu%hhn", sch, mpfr, uch, &uch);
+ check_length (10, uch, 22, hhu);
+#endif
+
+#if defined(HAVE_LONG_LONG) && !defined(NPRINTF_LL)
{
long long llo = -1;
unsigned long long ullo = 1;
diff -Naurd mpfr-2.4.0-a/vasprintf.c mpfr-2.4.0-b/vasprintf.c
--- mpfr-2.4.0-a/vasprintf.c 2009-01-26 12:52:01.000000000 +0000
+++ mpfr-2.4.0-b/vasprintf.c 2009-02-20 16:31:02.000000000 +0000
@@ -235,10 +235,14 @@
break;
case 'h':
if (*++format == 'h')
+#ifndef NPRINTF_HH
{
++format;
specinfo->arg_type = CHAR_ARG;
}
+#else
+ specinfo->arg_type = UNSUPPORTED;
+#endif
else
specinfo->arg_type = SHORT_ARG;
break;
@@ -246,7 +250,7 @@
if (*++format == 'l')
{
++format;
-#ifdef HAVE_LONG_LONG
+#if defined (HAVE_LONG_LONG) && !defined(NPRINTF_LL)
specinfo->arg_type = LONG_LONG_ARG;
#else
specinfo->arg_type = UNSUPPORTED;
diff -Naurd mpfr-2.4.0-a/version.c mpfr-2.4.0-b/version.c
--- mpfr-2.4.0-a/version.c 2009-01-26 12:52:01.000000000 +0000
+++ mpfr-2.4.0-b/version.c 2009-02-20 17:27:44.000000000 +0000
@@ -25,5 +25,5 @@
const char *
mpfr_get_version (void)
{
- return "2.4.0";
+ return "2.4.0-p1";
}

View File

@ -1,176 +0,0 @@
diff -Naurd mpfr-2.4.0-a/PATCHES mpfr-2.4.0-b/PATCHES
--- mpfr-2.4.0-a/PATCHES 2009-02-25 13:27:38.000000000 +0000
+++ mpfr-2.4.0-b/PATCHES 2009-02-25 13:42:26.000000000 +0000
@@ -0,0 +1 @@
+mpfr_snprintf
diff -Naurd mpfr-2.4.0-a/VERSION mpfr-2.4.0-b/VERSION
--- mpfr-2.4.0-a/VERSION 2009-02-20 17:27:44.000000000 +0000
+++ mpfr-2.4.0-b/VERSION 2009-02-25 13:41:31.000000000 +0000
@@ -1 +1 @@
-2.4.0-p1
+2.4.0-p2
diff -Naurd mpfr-2.4.0-a/mpfr.h mpfr-2.4.0-b/mpfr.h
--- mpfr-2.4.0-a/mpfr.h 2009-02-20 17:27:44.000000000 +0000
+++ mpfr-2.4.0-b/mpfr.h 2009-02-25 13:41:31.000000000 +0000
@@ -27,7 +27,7 @@
#define MPFR_VERSION_MAJOR 2
#define MPFR_VERSION_MINOR 4
#define MPFR_VERSION_PATCHLEVEL 0
-#define MPFR_VERSION_STRING "2.4.0-p1"
+#define MPFR_VERSION_STRING "2.4.0-p2"
/* Macros dealing with MPFR VERSION */
#define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
diff -Naurd mpfr-2.4.0-a/printf.c mpfr-2.4.0-b/printf.c
--- mpfr-2.4.0-a/printf.c 2009-01-26 12:52:01.000000000 +0000
+++ mpfr-2.4.0-b/printf.c 2009-02-25 13:41:22.000000000 +0000
@@ -154,16 +154,16 @@
int ret;
size_t min_size;
- /* C99 allows SIZE to be null */
- if (size == 0)
- return 0;
-
- MPFR_ASSERTD (buf != NULL);
-
GET_STR (ret, str, fmt);
- min_size = (size_t)ret < size ? (size_t)ret : size - 1;
- strncpy (buf, str, min_size);
- buf[min_size + 1] = '\0';
+
+ /* C99 allows SIZE to be zero */
+ if (size != 0)
+ {
+ MPFR_ASSERTN (buf != NULL);
+ min_size = (size_t)ret < size ? (size_t)ret : size - 1;
+ strncpy (buf, str, min_size);
+ buf[min_size] = '\0';
+ }
mpfr_free_str (str);
return ret;
@@ -176,16 +176,17 @@
int ret;
int min_size;
- /* C99 allows SIZE to be null */
- if (size == 0)
- return 0;
+ GET_STR_VA (ret, str, fmt, ap);
- MPFR_ASSERTD (buf != NULL);
+ /* C99 allows SIZE to be zero */
+ if (size != 0)
+ {
+ MPFR_ASSERTN (buf != NULL);
+ min_size = (size_t)ret < size ? (size_t)ret : size - 1;
+ strncpy (buf, str, min_size);
+ buf[min_size] = '\0';
+ }
- GET_STR_VA (ret, str, fmt, ap);
- min_size = (size_t)ret < size ? (size_t)ret : size - 1;
- strncpy (buf, str, min_size);
- buf[min_size + 1] = '\0';
mpfr_free_str (str);
return ret;
}
diff -Naurd mpfr-2.4.0-a/tests/tsprintf.c mpfr-2.4.0-b/tests/tsprintf.c
--- mpfr-2.4.0-a/tests/tsprintf.c 2009-01-26 12:52:00.000000000 +0000
+++ mpfr-2.4.0-b/tests/tsprintf.c 2009-02-25 13:41:22.000000000 +0000
@@ -72,21 +72,37 @@
/* test mpfr_snprintf */
p = (int) (randlimb () % n0);
- n1 = mpfr_snprintf (buffer, p, fmt, x);
- if ((p != 0 && n0 != n1) || (p == 0 && n1 != 0))
+ if (p == 0 && (randlimb () & 1) == 0)
+ {
+ n1 = mpfr_snprintf (NULL, 0, fmt, x);
+ }
+ else
+ {
+ buffer[p] = 17;
+ n1 = mpfr_snprintf (buffer, p, fmt, x);
+ if (buffer[p] != 17)
+ {
+ printf ("Buffer overflow in mpfr_snprintf for p = %d!\n", p);
+ exit (1);
+ }
+ }
+ if (n0 != n1)
{
printf ("Error in mpfr_snprintf (s, %d, \"%s\", x) return value\n",
p, fmt);
printf ("expected: %d\ngot: %d\n", n0, n1);
exit (1);
}
- if (strncmp (expected, buffer, p) != 0)
+ if ((p > 1 && strncmp (expected, buffer, p-1) != 0)
+ || (p == 1 && buffer[0] != '\0'))
{
- printf ("Error in mpfr_snprintf (s, %d, \"%s\", x);\n", p, fmt);
- printf ("expected: \"%s\"\ngot: \"%s\"\n", expected, buffer);
+ char part_expected[p];
+ strncpy (part_expected, expected, p);
+ part_expected[p-1] = '\0';
+ printf ("Error in mpfr_vsnprintf (s, %d, \"%s\", ...);\n", p, fmt);
+ printf ("expected: \"%s\"\ngot: \"%s\"\n", part_expected, buffer);
exit (1);
}
-
return n0;
}
@@ -116,8 +132,21 @@
/* test mpfr_snprintf */
p = (int) (randlimb () % n0);
- n1 = mpfr_vsnprintf (buffer, p, fmt, ap1);
- if ((p != 0 && n0 != n1) || (p == 0 && n1 != 0))
+ if (p == 0 && (randlimb () & 1) == 0)
+ {
+ n1 = mpfr_vsnprintf (NULL, 0, fmt, ap1);
+ }
+ else
+ {
+ buffer[p] = 17;
+ n1 = mpfr_vsnprintf (buffer, p, fmt, ap1);
+ if (buffer[p] != 17)
+ {
+ printf ("Buffer overflow in mpfr_vsnprintf for p = %d!\n", p);
+ exit (1);
+ }
+ }
+ if (n0 != n1)
{
printf ("Error in mpfr_vsnprintf (s, %d, \"%s\", ...) return value\n",
p, fmt);
@@ -126,10 +155,14 @@
va_end (ap1);
exit (1);
}
- if (strncmp (expected, buffer, p) != 0)
+ if ((p > 1 && strncmp (expected, buffer, p-1) != 0)
+ || (p == 1 && buffer[0] != '\0'))
{
+ char part_expected[p];
+ strncpy (part_expected, expected, p);
+ part_expected[p-1] = '\0';
printf ("Error in mpfr_vsnprintf (s, %d, \"%s\", ...);\n", p, fmt);
- printf ("expected: \"%s\"\ngot: \"%s\"\n", expected, buffer);
+ printf ("expected: \"%s\"\ngot: \"%s\"\n", part_expected, buffer);
va_end (ap1);
exit (1);
diff -Naurd mpfr-2.4.0-a/version.c mpfr-2.4.0-b/version.c
--- mpfr-2.4.0-a/version.c 2009-02-20 17:27:44.000000000 +0000
+++ mpfr-2.4.0-b/version.c 2009-02-25 13:41:31.000000000 +0000
@@ -25,5 +25,5 @@
const char *
mpfr_get_version (void)
{
- return "2.4.0-p1";
+ return "2.4.0-p2";
}

View File

@ -1 +0,0 @@
obsolete='yes'

View File

@ -1,123 +0,0 @@
diff -Naurd mpfr-2.4.1-a/PATCHES mpfr-2.4.1-b/PATCHES
--- mpfr-2.4.1-a/PATCHES 2009-02-20 09:43:17.000000000 +0000
+++ mpfr-2.4.1-b/PATCHES 2009-02-27 16:56:29.000000000 +0000
@@ -0,0 +1 @@
+remainder-neg
diff -Naurd mpfr-2.4.1-a/VERSION mpfr-2.4.1-b/VERSION
--- mpfr-2.4.1-a/VERSION 2009-02-25 16:16:08.000000000 +0000
+++ mpfr-2.4.1-b/VERSION 2009-02-27 16:55:37.000000000 +0000
@@ -1 +1 @@
-2.4.1
+2.4.1-p1
diff -Naurd mpfr-2.4.1-a/mpfr.h mpfr-2.4.1-b/mpfr.h
--- mpfr-2.4.1-a/mpfr.h 2009-02-25 16:16:08.000000000 +0000
+++ mpfr-2.4.1-b/mpfr.h 2009-02-27 16:55:38.000000000 +0000
@@ -27,7 +27,7 @@
#define MPFR_VERSION_MAJOR 2
#define MPFR_VERSION_MINOR 4
#define MPFR_VERSION_PATCHLEVEL 1
-#define MPFR_VERSION_STRING "2.4.1"
+#define MPFR_VERSION_STRING "2.4.1-p1"
/* Macros dealing with MPFR VERSION */
#define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
diff -Naurd mpfr-2.4.1-a/rem1.c mpfr-2.4.1-b/rem1.c
--- mpfr-2.4.1-a/rem1.c 2009-02-20 09:43:17.000000000 +0000
+++ mpfr-2.4.1-b/rem1.c 2009-02-27 16:55:15.000000000 +0000
@@ -170,7 +170,12 @@
}
if (mpz_cmp_ui (r, 0) == 0)
- inex = mpfr_set_ui (rem, 0, GMP_RNDN);
+ {
+ inex = mpfr_set_ui (rem, 0, GMP_RNDN);
+ /* take into account sign of x */
+ if (signx < 0)
+ mpfr_neg (rem, rem, GMP_RNDN);
+ }
else
{
if (rnd_q == GMP_RNDN)
@@ -190,6 +195,9 @@
*quo += 1;
}
}
+ /* take into account sign of x */
+ if (signx < 0)
+ mpz_neg (r, r);
inex = mpfr_set_z (rem, r, rnd);
/* if ex > ey, rem should be multiplied by 2^ey, else by 2^ex */
MPFR_EXP (rem) += (ex > ey) ? ey : ex;
@@ -198,13 +206,6 @@
if (quo)
*quo *= sign;
- /* take into account sign of x */
- if (signx < 0)
- {
- mpfr_neg (rem, rem, GMP_RNDN);
- inex = -inex;
- }
-
mpz_clear (mx);
mpz_clear (my);
mpz_clear (r);
diff -Naurd mpfr-2.4.1-a/tests/tremquo.c mpfr-2.4.1-b/tests/tremquo.c
--- mpfr-2.4.1-a/tests/tremquo.c 2009-02-20 09:43:15.000000000 +0000
+++ mpfr-2.4.1-b/tests/tremquo.c 2009-02-27 16:55:15.000000000 +0000
@@ -25,6 +25,36 @@
#include "mpfr-test.h"
+static void
+bug20090227 (void)
+{
+ mpfr_t x, y, r1, r2;
+ int inex1, inex2;
+
+ mpfr_init2 (x, 118);
+ mpfr_init2 (y, 181);
+ mpfr_init2 (r1, 140);
+ mpfr_init2 (r2, 140);
+ mpfr_set_si (x, -1, GMP_RNDN);
+ mpfr_set_str_binary (y, "1.100100100001111110110101010001000100001011010001100001000110100110001001100011001100010100010111000000011011100000111001101000100101001000000100100111000001000100010100110011111010");
+ inex1 = mpfr_remainder (r1, x, y, GMP_RNDU);
+ /* since the quotient is -1, r1 is the rounding of x+y */
+ inex2 = mpfr_add (r2, x, y, GMP_RNDU);
+ if (mpfr_cmp (r1, r2))
+ {
+ printf ("Error in mpfr_remainder (bug20090227)\n");
+ printf ("Expected ");
+ mpfr_dump (r2);
+ printf ("Got ");
+ mpfr_dump (r1);
+ exit (1);
+ }
+ mpfr_clear (x);
+ mpfr_clear (y);
+ mpfr_clear (r1);
+ mpfr_clear (r2);
+}
+
int
main (int argc, char *argv[])
{
@@ -50,6 +80,8 @@
tests_start_mpfr ();
+ bug20090227 ();
+
mpfr_init (x);
mpfr_init (y);
mpfr_init (r);
diff -Naurd mpfr-2.4.1-a/version.c mpfr-2.4.1-b/version.c
--- mpfr-2.4.1-a/version.c 2009-02-25 16:16:08.000000000 +0000
+++ mpfr-2.4.1-b/version.c 2009-02-27 16:55:38.000000000 +0000
@@ -25,5 +25,5 @@
const char *
mpfr_get_version (void)
{
- return "2.4.1";
+ return "2.4.1-p1";
}

View File

@ -1,45 +0,0 @@
diff -Naurd mpfr-2.4.1-a/PATCHES mpfr-2.4.1-b/PATCHES
--- mpfr-2.4.1-a/PATCHES 2009-03-04 13:15:05.000000000 +0000
+++ mpfr-2.4.1-b/PATCHES 2009-03-04 13:17:04.000000000 +0000
@@ -0,0 +1 @@
+assert
diff -Naurd mpfr-2.4.1-a/VERSION mpfr-2.4.1-b/VERSION
--- mpfr-2.4.1-a/VERSION 2009-02-27 16:55:37.000000000 +0000
+++ mpfr-2.4.1-b/VERSION 2009-03-04 13:16:46.000000000 +0000
@@ -1 +1 @@
-2.4.1-p1
+2.4.1-p2
diff -Naurd mpfr-2.4.1-a/mpfr-gmp.c mpfr-2.4.1-b/mpfr-gmp.c
--- mpfr-2.4.1-a/mpfr-gmp.c 2009-02-20 09:43:17.000000000 +0000
+++ mpfr-2.4.1-b/mpfr-gmp.c 2009-03-04 13:16:39.000000000 +0000
@@ -301,7 +301,7 @@
if (linenum != -1)
fprintf (stderr, "%d: ", linenum);
}
- fprintf (stderr, " assertion failed: %s\n", expr);
+ fprintf (stderr, "MPFR assertion failed: %s\n", expr);
abort();
}
diff -Naurd mpfr-2.4.1-a/mpfr.h mpfr-2.4.1-b/mpfr.h
--- mpfr-2.4.1-a/mpfr.h 2009-02-27 16:55:38.000000000 +0000
+++ mpfr-2.4.1-b/mpfr.h 2009-03-04 13:16:46.000000000 +0000
@@ -27,7 +27,7 @@
#define MPFR_VERSION_MAJOR 2
#define MPFR_VERSION_MINOR 4
#define MPFR_VERSION_PATCHLEVEL 1
-#define MPFR_VERSION_STRING "2.4.1-p1"
+#define MPFR_VERSION_STRING "2.4.1-p2"
/* Macros dealing with MPFR VERSION */
#define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
diff -Naurd mpfr-2.4.1-a/version.c mpfr-2.4.1-b/version.c
--- mpfr-2.4.1-a/version.c 2009-02-27 16:55:38.000000000 +0000
+++ mpfr-2.4.1-b/version.c 2009-03-04 13:16:46.000000000 +0000
@@ -25,5 +25,5 @@
const char *
mpfr_get_version (void)
{
- return "2.4.1-p1";
+ return "2.4.1-p2";
}

View File

@ -1,25 +0,0 @@
diff -Naurd mpfr-2.4.1-a/tests/tfprintf.c mpfr-2.4.1-b/tests/tfprintf.c
--- mpfr-2.4.1-a/tests/tfprintf.c 2009-02-20 09:43:15.000000000 +0000
+++ mpfr-2.4.1-b/tests/tfprintf.c 2009-03-10 01:12:45.000000000 +0000
@@ -195,7 +195,7 @@
check_vfprintf (fout, "a. %Pu, b. %c, c. %Zi%Zn", prec, ch, mpz, &mpz);
check_length_with_cmp (6, mpz, 17, mpz_cmp_ui (mpz, 17), Zi);
check_vfprintf (fout, "%% a. %#.0RNg, b. %Qx%Rn, c. %p", mpfr, mpq, &mpfr,
- &i);
+ (void *) &i);
check_length_with_cmp (7, mpfr, 16, mpfr_cmp_ui (mpfr, 16), Rg);
#ifndef NPRINTF_T
diff -Naurd mpfr-2.4.1-a/tests/tprintf.c mpfr-2.4.1-b/tests/tprintf.c
--- mpfr-2.4.1-a/tests/tprintf.c 2009-02-20 09:43:15.000000000 +0000
+++ mpfr-2.4.1-b/tests/tprintf.c 2009-03-10 01:12:45.000000000 +0000
@@ -191,7 +191,8 @@
check_length (5, sz, 34, zu);
check_vprintf ("a. %Pu, b. %c, c. %RUG, d. %Zi%Zn", prec, ch, mpfr, mpz, &mpz);
check_length_with_cmp (6, mpz, 24, mpz_cmp_ui (mpz, 24), Zi);
- check_vprintf ("%% a. %#.0RNg, b. %Qx%Rn c. %p", mpfr, mpq, &mpfr, &i);
+ check_vprintf ("%% a. %#.0RNg, b. %Qx%Rn c. %p",
+ mpfr, mpq, &mpfr, (void *) &i);
check_length_with_cmp (7, mpfr, 16, mpfr_cmp_ui (mpfr, 16), Rg);
#ifndef NPRINTF_T

View File

@ -1,45 +0,0 @@
diff -Naurd mpfr-2.4.1-a/PATCHES mpfr-2.4.1-b/PATCHES
--- mpfr-2.4.1-a/PATCHES 2009-03-10 01:44:39.000000000 +0000
+++ mpfr-2.4.1-b/PATCHES 2009-03-10 01:44:40.000000000 +0000
@@ -0,0 +1 @@
+vasprintf-mp_limb_t
diff -Naurd mpfr-2.4.1-a/VERSION mpfr-2.4.1-b/VERSION
--- mpfr-2.4.1-a/VERSION 2009-03-04 13:16:46.000000000 +0000
+++ mpfr-2.4.1-b/VERSION 2009-03-10 01:44:40.000000000 +0000
@@ -1 +1 @@
-2.4.1-p2
+2.4.1-p4
diff -Naurd mpfr-2.4.1-a/mpfr.h mpfr-2.4.1-b/mpfr.h
--- mpfr-2.4.1-a/mpfr.h 2009-03-04 13:16:46.000000000 +0000
+++ mpfr-2.4.1-b/mpfr.h 2009-03-10 01:44:40.000000000 +0000
@@ -27,7 +27,7 @@
#define MPFR_VERSION_MAJOR 2
#define MPFR_VERSION_MINOR 4
#define MPFR_VERSION_PATCHLEVEL 1
-#define MPFR_VERSION_STRING "2.4.1-p2"
+#define MPFR_VERSION_STRING "2.4.1-p4"
/* Macros dealing with MPFR VERSION */
#define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
diff -Naurd mpfr-2.4.1-a/vasprintf.c mpfr-2.4.1-b/vasprintf.c
--- mpfr-2.4.1-a/vasprintf.c 2009-02-20 09:43:17.000000000 +0000
+++ mpfr-2.4.1-b/vasprintf.c 2009-03-10 01:44:40.000000000 +0000
@@ -398,7 +398,7 @@
(void) va_arg ((ap), mpq_srcptr); \
break; \
case MP_LIMB_ARG: \
- (void) va_arg ((ap), mp_ptr); \
+ (void) va_arg ((ap), mp_limb_t); \
break; \
case MP_LIMB_ARRAY_ARG: \
(void) va_arg ((ap), mp_ptr); \
diff -Naurd mpfr-2.4.1-a/version.c mpfr-2.4.1-b/version.c
--- mpfr-2.4.1-a/version.c 2009-03-04 13:16:46.000000000 +0000
+++ mpfr-2.4.1-b/version.c 2009-03-10 01:44:40.000000000 +0000
@@ -25,5 +25,5 @@
const char *
mpfr_get_version (void)
{
- return "2.4.1-p2";
+ return "2.4.1-p4";
}

View File

@ -1,47 +0,0 @@
diff -Naurd mpfr-2.4.1-a/PATCHES mpfr-2.4.1-b/PATCHES
--- mpfr-2.4.1-a/PATCHES 2009-03-13 02:50:47.000000000 +0000
+++ mpfr-2.4.1-b/PATCHES 2009-03-13 02:50:48.000000000 +0000
@@ -0,0 +1 @@
+zeta_ui-shift
diff -Naurd mpfr-2.4.1-a/VERSION mpfr-2.4.1-b/VERSION
--- mpfr-2.4.1-a/VERSION 2009-03-10 01:44:40.000000000 +0000
+++ mpfr-2.4.1-b/VERSION 2009-03-13 02:50:48.000000000 +0000
@@ -1 +1 @@
-2.4.1-p4
+2.4.1-p5
diff -Naurd mpfr-2.4.1-a/mpfr.h mpfr-2.4.1-b/mpfr.h
--- mpfr-2.4.1-a/mpfr.h 2009-03-10 01:44:40.000000000 +0000
+++ mpfr-2.4.1-b/mpfr.h 2009-03-13 02:50:48.000000000 +0000
@@ -27,7 +27,7 @@
#define MPFR_VERSION_MAJOR 2
#define MPFR_VERSION_MINOR 4
#define MPFR_VERSION_PATCHLEVEL 1
-#define MPFR_VERSION_STRING "2.4.1-p4"
+#define MPFR_VERSION_STRING "2.4.1-p5"
/* Macros dealing with MPFR VERSION */
#define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
diff -Naurd mpfr-2.4.1-a/version.c mpfr-2.4.1-b/version.c
--- mpfr-2.4.1-a/version.c 2009-03-10 01:44:40.000000000 +0000
+++ mpfr-2.4.1-b/version.c 2009-03-13 02:50:48.000000000 +0000
@@ -25,5 +25,5 @@
const char *
mpfr_get_version (void)
{
- return "2.4.1-p4";
+ return "2.4.1-p5";
}
diff -Naurd mpfr-2.4.1-a/zeta_ui.c mpfr-2.4.1-b/zeta_ui.c
--- mpfr-2.4.1-a/zeta_ui.c 2009-02-20 09:43:17.000000000 +0000
+++ mpfr-2.4.1-b/zeta_ui.c 2009-03-13 02:50:48.000000000 +0000
@@ -177,7 +177,9 @@
mpz_mul_ui (t, t, 2 * k - 1);
}
mpz_div_2exp (t, t, 1);
- if (n < 1UL << (BITS_PER_MP_LIMB / 2))
+ /* Warning: the test below assumes that an unsigned long
+ has no padding bits. */
+ if (n < 1UL << ((sizeof(unsigned long) * CHAR_BIT) / 2))
/* (n - k + 1) * (n + k - 1) < n^2 */
mpz_divexact_ui (t, t, (n - k + 1) * (n + k - 1));
else

View File

@ -1,40 +0,0 @@
diff -up ./tests/Makefile.am.orig ./tests/Makefile.am
--- ./tests/Makefile.am.orig 2009-07-28 16:28:55.377059021 +0300
+++ ./tests/Makefile.am 2009-07-28 16:31:01.136810734 +0300
@@ -20,7 +20,7 @@ check_PROGRAMS = tversion tinternals tin
EXTRA_DIST = tgeneric.c tgeneric_ui.c mpf_compat.h inp_str.data tmul.dat
-tmul_CPPFLAGS = -DMPFR_SRCDIR=$(srcdir)
+tmul_CPPFLAGS = -DMPFR_SRCDIR=\"$(srcdir)\"
LDADD = libfrtests.la $(MPFR_LIBM) $(top_builddir)/libmpfr.la
INCLUDES = -I$(top_srcdir) -I$(top_builddir)
diff -up ./tests/tmul.c.orig ./tests/tmul.c
--- ./tests/tmul.c.orig 2009-07-28 16:29:03.761058919 +0300
+++ ./tests/tmul.c 2009-07-28 16:30:46.369812215 +0300
@@ -26,10 +26,8 @@ MA 02110-1301, USA. */
#include "mpfr-test.h"
#ifndef MPFR_SRCDIR
-#define MPFR_SRCDIR .
+#define MPFR_SRCDIR "."
#endif
-#define QUOTE(X) NAME(X)
-#define NAME(X) #X
#ifdef CHECK_EXTERNAL
static int
@@ -482,10 +480,10 @@ check_regression (void)
mpfr_inits2 (6177, x, y, z, (mpfr_ptr) 0);
/* we read long strings from a file since ISO C90 does not support strings of
length > 509 */
- fp = fopen (QUOTE (MPFR_SRCDIR)"/tmul.dat", "r");
+ fp = fopen (MPFR_SRCDIR "/tmul.dat", "r");
if (fp == NULL)
{
- fprintf (stderr, "Error, cannot open "QUOTE (MPFR_SRCDIR)"/tmul.dat\n");
+ fprintf (stderr, "Error, cannot open " MPFR_SRCDIR "/tmul.dat\n");
exit (1);
}
get_string (s, fp);

View File

@ -1 +0,0 @@
obsolete='yes'

View File

@ -1,220 +0,0 @@
diff -Naurd mpfr-3.0.0-a/PATCHES mpfr-3.0.0-b/PATCHES
--- mpfr-3.0.0-a/PATCHES 2010-06-23 11:02:49.000000000 +0000
+++ mpfr-3.0.0-b/PATCHES 2010-06-23 11:03:36.000000000 +0000
@@ -0,0 +1 @@
+mpfr_out_str
diff -Naurd mpfr-3.0.0-a/VERSION mpfr-3.0.0-b/VERSION
--- mpfr-3.0.0-a/VERSION 2010-06-10 11:00:14.000000000 +0000
+++ mpfr-3.0.0-b/VERSION 2010-06-23 11:03:20.000000000 +0000
@@ -1 +1 @@
-3.0.0
+3.0.0-p1
diff -Naurd mpfr-3.0.0-a/mpfr.h mpfr-3.0.0-b/mpfr.h
--- mpfr-3.0.0-a/mpfr.h 2010-06-10 11:00:14.000000000 +0000
+++ mpfr-3.0.0-b/mpfr.h 2010-06-23 11:03:20.000000000 +0000
@@ -27,7 +27,7 @@
#define MPFR_VERSION_MAJOR 3
#define MPFR_VERSION_MINOR 0
#define MPFR_VERSION_PATCHLEVEL 0
-#define MPFR_VERSION_STRING "3.0.0"
+#define MPFR_VERSION_STRING "3.0.0-p1"
/* Macros dealing with MPFR VERSION */
#define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
diff -Naurd mpfr-3.0.0-a/mpfr.texi mpfr-3.0.0-b/mpfr.texi
--- mpfr-3.0.0-a/mpfr.texi 2010-06-10 11:00:14.000000000 +0000
+++ mpfr-3.0.0-b/mpfr.texi 2010-06-23 11:03:12.000000000 +0000
@@ -2050,7 +2050,7 @@
are printed. If @var{base} is greater than 10, @samp{@@} will be used
instead of @samp{e} as exponent delimiter.
-Return the number of bytes written, or if an error occurred, return 0.
+Return the number of characters written, or if an error occurred, return 0.
@end deftypefun
@deftypefun size_t mpfr_inp_str (mpfr_t @var{rop}, FILE *@var{stream}, int @var{base}, mpfr_rnd_t @var{rnd})
diff -Naurd mpfr-3.0.0-a/out_str.c mpfr-3.0.0-b/out_str.c
--- mpfr-3.0.0-a/out_str.c 2010-06-10 11:00:14.000000000 +0000
+++ mpfr-3.0.0-b/out_str.c 2010-06-23 11:03:12.000000000 +0000
@@ -22,6 +22,16 @@
#include "mpfr-impl.h"
+/* Warning! S should not contain "%". */
+#define OUT_STR_RET(S) \
+ do \
+ { \
+ int r; \
+ r = fprintf (stream, (S)); \
+ return r < 0 ? 0 : r; \
+ } \
+ while (0)
+
size_t
mpfr_out_str (FILE *stream, int base, size_t n_digits, mpfr_srcptr op,
mpfr_rnd_t rnd_mode)
@@ -29,6 +39,7 @@
char *s, *s0;
size_t l;
mpfr_exp_t e;
+ int err;
MPFR_ASSERTN (base >= 2 && base <= 62);
@@ -36,37 +47,16 @@
if (stream == NULL)
stream = stdout;
- if (MPFR_IS_NAN(op))
- {
- fprintf (stream, "@NaN@");
- return 3;
- }
-
- if (MPFR_IS_INF(op))
- {
- if (MPFR_SIGN(op) > 0)
- {
- fprintf (stream, "@Inf@");
- return 3;
- }
- else
- {
- fprintf (stream, "-@Inf@");
- return 4;
- }
- }
-
- if (MPFR_IS_ZERO(op))
+ if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (op)))
{
- if (MPFR_SIGN(op) > 0)
- {
- fprintf(stream, "0");
- return 1;
- }
+ if (MPFR_IS_NAN (op))
+ OUT_STR_RET ("@NaN@");
+ else if (MPFR_IS_INF (op))
+ OUT_STR_RET (MPFR_IS_POS (op) ? "@Inf@" : "-@Inf@");
else
{
- fprintf(stream, "-0");
- return 2;
+ MPFR_ASSERTD (MPFR_IS_ZERO (op));
+ OUT_STR_RET (MPFR_IS_POS (op) ? "0" : "-0");
}
}
@@ -77,21 +67,31 @@
l = strlen (s) + 1; /* size of allocated block returned by mpfr_get_str
- may be incorrect, as only an upper bound? */
- if (*s == '-')
- fputc (*s++, stream);
- /* outputs mantissa */
- fputc (*s++, stream); e--; /* leading digit */
- fputc ((unsigned char) MPFR_DECIMAL_POINT, stream);
- fputs (s, stream); /* rest of mantissa */
+ /* outputs possible sign and significand */
+ err = (*s == '-' && fputc (*s++, stream) == EOF)
+ || fputc (*s++, stream) == EOF /* leading digit */
+ || fputc ((unsigned char) MPFR_DECIMAL_POINT, stream) == EOF
+ || fputs (s, stream) == EOF; /* trailing significand */
(*__gmp_free_func) (s0, l);
+ if (MPFR_UNLIKELY (err))
+ return 0;
+
+ e--; /* due to the leading digit */
/* outputs exponent */
if (e)
{
+ int r;
+
MPFR_ASSERTN(e >= LONG_MIN);
MPFR_ASSERTN(e <= LONG_MAX);
- l += fprintf (stream, (base <= 10 ? "e%ld" : "@%ld"), (long) e);
+
+ r = fprintf (stream, (base <= 10 ? "e%ld" : "@%ld"), (long) e);
+ if (MPFR_UNLIKELY (r < 0))
+ return 0;
+
+ l += r;
}
return l;
diff -Naurd mpfr-3.0.0-a/tests/tout_str.c mpfr-3.0.0-b/tests/tout_str.c
--- mpfr-3.0.0-a/tests/tout_str.c 2010-06-10 11:00:13.000000000 +0000
+++ mpfr-3.0.0-b/tests/tout_str.c 2010-06-23 11:03:12.000000000 +0000
@@ -46,22 +46,54 @@
special (void)
{
mpfr_t x;
+ unsigned int n;
mpfr_init (x);
mpfr_set_nan (x);
- mpfr_out_str (fout, 10, 0, x, MPFR_RNDN);
+ n = mpfr_out_str (fout, 10, 0, x, MPFR_RNDN);
+ if (n != 5)
+ {
+ printf ("Error: mpfr_out_str (file, 10, 0, NaN, MPFR_RNDN) wrote %u "
+ "characters instead of 5.\n", n);
+ exit (1);
+ }
mpfr_set_inf (x, 1);
- mpfr_out_str (fout, 10, 0, x, MPFR_RNDN);
+ n = mpfr_out_str (fout, 10, 0, x, MPFR_RNDN);
+ if (n != 5)
+ {
+ printf ("Error: mpfr_out_str (file, 10, 0, +Inf, MPFR_RNDN) wrote %u "
+ "characters instead of 5.\n", n);
+ exit (1);
+ }
mpfr_set_inf (x, -1);
- mpfr_out_str (fout, 10, 0, x, MPFR_RNDN);
+ n = mpfr_out_str (fout, 10, 0, x, MPFR_RNDN);
+ if (n != 6)
+ {
+ printf ("Error: mpfr_out_str (file, 10, 0, -Inf, MPFR_RNDN) wrote %u "
+ "characters instead of 6.\n", n);
+ exit (1);
+ }
mpfr_set_ui (x, 0, MPFR_RNDN);
- mpfr_out_str (fout, 10, 0, x, MPFR_RNDN);
+ n = mpfr_out_str (fout, 10, 0, x, MPFR_RNDN);
+ if (n != 1)
+ {
+ printf ("Error: mpfr_out_str (file, 10, 0, +0, MPFR_RNDN) wrote %u "
+ "characters instead of 1.\n", n);
+ exit (1);
+ }
+
mpfr_neg (x, x, MPFR_RNDN);
- mpfr_out_str (fout, 10, 0, x, MPFR_RNDN);
+ n = mpfr_out_str (fout, 10, 0, x, MPFR_RNDN);
+ if (n != 2)
+ {
+ printf ("Error: mpfr_out_str (file, 10, 0, -0, MPFR_RNDN) wrote %u "
+ "characters instead of 2.\n", n);
+ exit (1);
+ }
mpfr_clear (x);
}
diff -Naurd mpfr-3.0.0-a/version.c mpfr-3.0.0-b/version.c
--- mpfr-3.0.0-a/version.c 2010-06-10 11:00:14.000000000 +0000
+++ mpfr-3.0.0-b/version.c 2010-06-23 11:03:20.000000000 +0000
@@ -25,5 +25,5 @@
const char *
mpfr_get_version (void)
{
- return "3.0.0";
+ return "3.0.0-p1";
}

View File

@ -1,377 +0,0 @@
diff -Naurd mpfr-3.0.0-a/Makefile.in mpfr-3.0.0-b/Makefile.in
--- mpfr-3.0.0-a/Makefile.in 2010-06-10 11:00:52.000000000 +0000
+++ mpfr-3.0.0-b/Makefile.in 2010-06-10 11:00:52.000000000 +0000
@@ -239,6 +239,7 @@
distuninstallcheck_listfiles = find . -type f -print
distcleancheck_listfiles = find . -type f -print
ACLOCAL = @ACLOCAL@
+ALLOCA = @ALLOCA@
AMTAR = @AMTAR@
AR = @AR@
AS = @AS@
diff -Naurd mpfr-3.0.0-a/PATCHES mpfr-3.0.0-b/PATCHES
--- mpfr-3.0.0-a/PATCHES 2010-06-23 11:03:36.000000000 +0000
+++ mpfr-3.0.0-b/PATCHES 2010-06-25 13:23:13.000000000 +0000
@@ -0,0 +1 @@
+alloca
diff -Naurd mpfr-3.0.0-a/VERSION mpfr-3.0.0-b/VERSION
--- mpfr-3.0.0-a/VERSION 2010-06-23 11:03:20.000000000 +0000
+++ mpfr-3.0.0-b/VERSION 2010-06-25 13:23:13.000000000 +0000
@@ -1 +1 @@
-3.0.0-p1
+3.0.0-p2
diff -Naurd mpfr-3.0.0-a/acinclude.m4 mpfr-3.0.0-b/acinclude.m4
--- mpfr-3.0.0-a/acinclude.m4 2010-06-10 11:00:14.000000000 +0000
+++ mpfr-3.0.0-b/acinclude.m4 2010-06-10 11:00:14.000000000 +0000
@@ -59,6 +59,9 @@
dnl sys/fpu.h - MIPS specific
AC_CHECK_HEADERS([sys/time.h sys/fpu.h])
+dnl Check how to get `alloca'
+AC_FUNC_ALLOCA
+
dnl SIZE_MAX macro
gl_SIZE_MAX
diff -Naurd mpfr-3.0.0-a/configure mpfr-3.0.0-b/configure
--- mpfr-3.0.0-a/configure 2010-06-10 11:00:51.000000000 +0000
+++ mpfr-3.0.0-b/configure 2010-06-25 13:23:05.000000000 +0000
@@ -783,6 +783,7 @@
OBJDUMP
DLLTOOL
AS
+ALLOCA
MPFR_LIBM
ANSI2KNR
U
@@ -5622,6 +5623,197 @@
done
+# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
+# for constant arguments. Useless!
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working alloca.h" >&5
+$as_echo_n "checking for working alloca.h... " >&6; }
+if test "${ac_cv_working_alloca_h+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <alloca.h>
+int
+main ()
+{
+char *p = (char *) alloca (2 * sizeof (int));
+ if (p) return 0;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_working_alloca_h=yes
+else
+ ac_cv_working_alloca_h=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_working_alloca_h" >&5
+$as_echo "$ac_cv_working_alloca_h" >&6; }
+if test $ac_cv_working_alloca_h = yes; then
+
+$as_echo "#define HAVE_ALLOCA_H 1" >>confdefs.h
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for alloca" >&5
+$as_echo_n "checking for alloca... " >&6; }
+if test "${ac_cv_func_alloca_works+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#ifdef __GNUC__
+# define alloca __builtin_alloca
+#else
+# ifdef _MSC_VER
+# include <malloc.h>
+# define alloca _alloca
+# else
+# ifdef HAVE_ALLOCA_H
+# include <alloca.h>
+# else
+# ifdef _AIX
+ #pragma alloca
+# else
+# ifndef alloca /* predefined by HP cc +Olibcalls */
+char *alloca ();
+# endif
+# endif
+# endif
+# endif
+#endif
+
+int
+main ()
+{
+char *p = (char *) alloca (1);
+ if (p) return 0;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_func_alloca_works=yes
+else
+ ac_cv_func_alloca_works=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_alloca_works" >&5
+$as_echo "$ac_cv_func_alloca_works" >&6; }
+
+if test $ac_cv_func_alloca_works = yes; then
+
+$as_echo "#define HAVE_ALLOCA 1" >>confdefs.h
+
+else
+ # The SVR3 libPW and SVR4 libucb both contain incompatible functions
+# that cause trouble. Some versions do not even contain alloca or
+# contain a buggy version. If you still want to use their alloca,
+# use ar to extract alloca.o from them instead of compiling alloca.c.
+
+ALLOCA=\${LIBOBJDIR}alloca.$ac_objext
+
+$as_echo "#define C_ALLOCA 1" >>confdefs.h
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether \`alloca.c' needs Cray hooks" >&5
+$as_echo_n "checking whether \`alloca.c' needs Cray hooks... " >&6; }
+if test "${ac_cv_os_cray+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#if defined CRAY && ! defined CRAY2
+webecray
+#else
+wenotbecray
+#endif
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "webecray" >/dev/null 2>&1; then :
+ ac_cv_os_cray=yes
+else
+ ac_cv_os_cray=no
+fi
+rm -f conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_os_cray" >&5
+$as_echo "$ac_cv_os_cray" >&6; }
+if test $ac_cv_os_cray = yes; then
+ for ac_func in _getb67 GETB67 getb67; do
+ as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+eval as_val=\$$as_ac_var
+ if test "x$as_val" = x""yes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define CRAY_STACKSEG_END $ac_func
+_ACEOF
+
+ break
+fi
+
+ done
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking stack direction for C alloca" >&5
+$as_echo_n "checking stack direction for C alloca... " >&6; }
+if test "${ac_cv_c_stack_direction+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test "$cross_compiling" = yes; then :
+ ac_cv_c_stack_direction=0
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$ac_includes_default
+int
+find_stack_direction ()
+{
+ static char *addr = 0;
+ auto char dummy;
+ if (addr == 0)
+ {
+ addr = &dummy;
+ return find_stack_direction ();
+ }
+ else
+ return (&dummy > addr) ? 1 : -1;
+}
+
+int
+main ()
+{
+ return find_stack_direction () < 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ ac_cv_c_stack_direction=1
+else
+ ac_cv_c_stack_direction=-1
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_stack_direction" >&5
+$as_echo "$ac_cv_c_stack_direction" >&6; }
+cat >>confdefs.h <<_ACEOF
+#define STACK_DIRECTION $ac_cv_c_stack_direction
+_ACEOF
+
+
+fi
+
+
for ac_header in stdint.h
do :
@@ -7564,13 +7756,13 @@
else
lt_cv_nm_interface="BSD nm"
echo "int some_variable = 0;" > conftest.$ac_ext
- (eval echo "\"\$as_me:7567: $ac_compile\"" >&5)
+ (eval echo "\"\$as_me:7759: $ac_compile\"" >&5)
(eval "$ac_compile" 2>conftest.err)
cat conftest.err >&5
- (eval echo "\"\$as_me:7570: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
+ (eval echo "\"\$as_me:7762: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
(eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
cat conftest.err >&5
- (eval echo "\"\$as_me:7573: output\"" >&5)
+ (eval echo "\"\$as_me:7765: output\"" >&5)
cat conftest.out >&5
if $GREP 'External.*some_variable' conftest.out > /dev/null; then
lt_cv_nm_interface="MS dumpbin"
@@ -8772,7 +8964,7 @@
;;
*-*-irix6*)
# Find out which ABI we are using.
- echo '#line 8775 "configure"' > conftest.$ac_ext
+ echo '#line 8967 "configure"' > conftest.$ac_ext
if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
(eval $ac_compile) 2>&5
ac_status=$?
@@ -10032,11 +10224,11 @@
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:10035: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:10227: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:10039: \$? = $ac_status" >&5
+ echo "$as_me:10231: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -10371,11 +10563,11 @@
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:10374: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:10566: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:10378: \$? = $ac_status" >&5
+ echo "$as_me:10570: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -10476,11 +10668,11 @@
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:10479: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:10671: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:10483: \$? = $ac_status" >&5
+ echo "$as_me:10675: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -10531,11 +10723,11 @@
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:10534: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:10726: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:10538: \$? = $ac_status" >&5
+ echo "$as_me:10730: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -12915,7 +13107,7 @@
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12918 "configure"
+#line 13110 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -13011,7 +13203,7 @@
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 13014 "configure"
+#line 13206 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
diff -Naurd mpfr-3.0.0-a/mpfr.h mpfr-3.0.0-b/mpfr.h
--- mpfr-3.0.0-a/mpfr.h 2010-06-23 11:03:20.000000000 +0000
+++ mpfr-3.0.0-b/mpfr.h 2010-06-25 13:23:13.000000000 +0000
@@ -27,7 +27,7 @@
#define MPFR_VERSION_MAJOR 3
#define MPFR_VERSION_MINOR 0
#define MPFR_VERSION_PATCHLEVEL 0
-#define MPFR_VERSION_STRING "3.0.0-p1"
+#define MPFR_VERSION_STRING "3.0.0-p2"
/* Macros dealing with MPFR VERSION */
#define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
diff -Naurd mpfr-3.0.0-a/tests/Makefile.in mpfr-3.0.0-b/tests/Makefile.in
--- mpfr-3.0.0-a/tests/Makefile.in 2010-06-10 11:00:52.000000000 +0000
+++ mpfr-3.0.0-b/tests/Makefile.in 2010-06-10 11:00:52.000000000 +0000
@@ -960,6 +960,7 @@
red=; grn=; lgn=; blu=; std=
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
+ALLOCA = @ALLOCA@
AMTAR = @AMTAR@
AR = @AR@
AS = @AS@
diff -Naurd mpfr-3.0.0-a/version.c mpfr-3.0.0-b/version.c
--- mpfr-3.0.0-a/version.c 2010-06-23 11:03:20.000000000 +0000
+++ mpfr-3.0.0-b/version.c 2010-06-25 13:23:13.000000000 +0000
@@ -25,5 +25,5 @@
const char *
mpfr_get_version (void)
{
- return "3.0.0-p1";
+ return "3.0.0-p2";
}

View File

@ -1,88 +0,0 @@
diff -Naurd mpfr-3.0.0-a/PATCHES mpfr-3.0.0-b/PATCHES
--- mpfr-3.0.0-a/PATCHES 2010-07-10 00:11:19.000000000 +0000
+++ mpfr-3.0.0-b/PATCHES 2010-07-10 00:12:50.000000000 +0000
@@ -0,0 +1 @@
+gamma_underflow
diff -Naurd mpfr-3.0.0-a/VERSION mpfr-3.0.0-b/VERSION
--- mpfr-3.0.0-a/VERSION 2010-06-25 13:23:13.000000000 +0000
+++ mpfr-3.0.0-b/VERSION 2010-07-10 00:11:53.000000000 +0000
@@ -1 +1 @@
-3.0.0-p2
+3.0.0-p3
diff -Naurd mpfr-3.0.0-a/gamma.c mpfr-3.0.0-b/gamma.c
--- mpfr-3.0.0-a/gamma.c 2010-06-10 11:00:14.000000000 +0000
+++ mpfr-3.0.0-b/gamma.c 2010-07-10 00:11:46.000000000 +0000
@@ -274,7 +274,7 @@
/* we want an upper bound for x * [log(2-x)-1].
since x < 0, we need a lower bound on log(2-x) */
mpfr_ui_sub (xp, 2, x, MPFR_RNDD);
- mpfr_log (xp, xp, MPFR_RNDD);
+ mpfr_log2 (xp, xp, MPFR_RNDD);
mpfr_sub_ui (xp, xp, 1, MPFR_RNDD);
mpfr_mul (xp, xp, x, MPFR_RNDU);
@@ -303,8 +303,8 @@
{
mpfr_sub (tmp, tmp, tmp2, MPFR_RNDZ); /* low bnd on |sin(Pi*(2-x))| */
mpfr_ui_div (tmp, 12, tmp, MPFR_RNDU); /* upper bound */
- mpfr_log (tmp, tmp, MPFR_RNDU);
- mpfr_add (tmp, tmp, xp, MPFR_RNDU);
+ mpfr_log2 (tmp, tmp, MPFR_RNDU);
+ mpfr_add (xp, tmp, xp, MPFR_RNDU);
underflow = mpfr_cmp_si (xp, expo.saved_emin - 2) <= 0;
}
diff -Naurd mpfr-3.0.0-a/mpfr.h mpfr-3.0.0-b/mpfr.h
--- mpfr-3.0.0-a/mpfr.h 2010-06-25 13:23:13.000000000 +0000
+++ mpfr-3.0.0-b/mpfr.h 2010-07-10 00:11:53.000000000 +0000
@@ -27,7 +27,7 @@
#define MPFR_VERSION_MAJOR 3
#define MPFR_VERSION_MINOR 0
#define MPFR_VERSION_PATCHLEVEL 0
-#define MPFR_VERSION_STRING "3.0.0-p2"
+#define MPFR_VERSION_STRING "3.0.0-p3"
/* Macros dealing with MPFR VERSION */
#define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
diff -Naurd mpfr-3.0.0-a/tests/tgamma.c mpfr-3.0.0-b/tests/tgamma.c
--- mpfr-3.0.0-a/tests/tgamma.c 2010-06-10 11:00:13.000000000 +0000
+++ mpfr-3.0.0-b/tests/tgamma.c 2010-07-10 00:11:46.000000000 +0000
@@ -461,6 +461,20 @@
mpfr_clear (x);
}
+/* bug found by Stathis, only occurs on 32-bit machines */
+static void
+test20100709 (void)
+{
+ mpfr_t x;
+ int inex;
+
+ mpfr_init2 (x, 100);
+ mpfr_set_str (x, "-4.6308260837372266e+07", 10, MPFR_RNDN);
+ inex = mpfr_gamma (x, x, MPFR_RNDN);
+ MPFR_ASSERTN(MPFR_IS_ZERO(x) && MPFR_IS_NEG(x) && inex > 0);
+ mpfr_clear (x);
+}
+
int
main (int argc, char *argv[])
{
@@ -471,6 +485,7 @@
test_generic (2, 100, 2);
gamma_integer ();
test20071231 ();
+ test20100709 ();
data_check ("data/gamma", mpfr_gamma, "mpfr_gamma");
diff -Naurd mpfr-3.0.0-a/version.c mpfr-3.0.0-b/version.c
--- mpfr-3.0.0-a/version.c 2010-06-25 13:23:13.000000000 +0000
+++ mpfr-3.0.0-b/version.c 2010-07-10 00:11:53.000000000 +0000
@@ -25,5 +25,5 @@
const char *
mpfr_get_version (void)
{
- return "3.0.0-p2";
+ return "3.0.0-p3";
}

View File

@ -1,239 +0,0 @@
diff -Naurd mpfr-3.0.0-a/PATCHES mpfr-3.0.0-b/PATCHES
--- mpfr-3.0.0-a/PATCHES 2010-09-07 08:44:01.000000000 +0000
+++ mpfr-3.0.0-b/PATCHES 2010-09-07 08:48:46.000000000 +0000
@@ -0,0 +1 @@
+mpfr_cmp/set_ui/si
diff -Naurd mpfr-3.0.0-a/VERSION mpfr-3.0.0-b/VERSION
--- mpfr-3.0.0-a/VERSION 2010-07-10 00:11:53.000000000 +0000
+++ mpfr-3.0.0-b/VERSION 2010-09-07 08:46:06.000000000 +0000
@@ -1 +1 @@
-3.0.0-p3
+3.0.0-p4
diff -Naurd mpfr-3.0.0-a/mpfr.h mpfr-3.0.0-b/mpfr.h
--- mpfr-3.0.0-a/mpfr.h 2010-07-10 00:11:53.000000000 +0000
+++ mpfr-3.0.0-b/mpfr.h 2010-09-07 08:46:06.000000000 +0000
@@ -27,7 +27,7 @@
#define MPFR_VERSION_MAJOR 3
#define MPFR_VERSION_MINOR 0
#define MPFR_VERSION_PATCHLEVEL 0
-#define MPFR_VERSION_STRING "3.0.0-p3"
+#define MPFR_VERSION_STRING "3.0.0-p4"
/* Macros dealing with MPFR VERSION */
#define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
@@ -798,35 +798,45 @@
anyway. Checking with other ICC versions is needed. Possibly detect
whether warnings are produced or not with a configure test.
+ Remove C++ too, since it complains too much. */
+/* Added casts to improve robustness in case of undefined behavior and
+ compiler extensions based on UB (in particular -fwrapv). MPFR doesn't
+ use such extensions, but these macros will be used by 3rd-party code,
+ where such extensions may be required.
+ Moreover casts to unsigned long have been added to avoid warnings in
+ programs that use MPFR and are compiled with -Wconversion; such casts
+ are OK since if X is a constant expression, then (unsigned long) X is
+ also a constant expression, so that the optimizations still work. */
#if defined (__GNUC__) && !defined(__ICC) && !defined(__cplusplus)
#if (__GNUC__ >= 2)
#undef mpfr_cmp_ui
-/* We use the fact that mpfr_sgn on NaN sets the erange flag and returns 0. */
-#define mpfr_cmp_ui(_f,_u) \
- (__builtin_constant_p (_u) && (_u) == 0 ? \
- mpfr_sgn (_f) : \
- mpfr_cmp_ui_2exp ((_f),(_u),0))
+/* We use the fact that mpfr_sgn on NaN sets the erange flag and returns 0.
+ But warning! mpfr_sgn is specified as a macro in the API, thus the macro
+ mustn't be used if side effects are possible, like here. */
+#define mpfr_cmp_ui(_f,_u) \
+ (__builtin_constant_p (_u) && (unsigned long) (_u) == 0 ? \
+ (mpfr_sgn) (_f) : \
+ mpfr_cmp_ui_2exp ((_f), (unsigned long) (_u), 0))
#undef mpfr_cmp_si
-#define mpfr_cmp_si(_f,_s) \
- (__builtin_constant_p (_s) && (_s) >= 0 ? \
- mpfr_cmp_ui ((_f), (_s)) : \
- mpfr_cmp_si_2exp ((_f), (_s), 0))
+#define mpfr_cmp_si(_f,_s) \
+ (__builtin_constant_p (_s) && (long) (_s) >= 0 ? \
+ mpfr_cmp_ui ((_f), (unsigned long) (long) (_s)) : \
+ mpfr_cmp_si_2exp ((_f), (long) (_s), 0))
#if __GNUC__ > 2 || __GNUC_MINOR__ >= 95
#undef mpfr_set_ui
-#define mpfr_set_ui(_f,_u,_r) \
- (__builtin_constant_p (_u) && (_u) == 0 ? \
- __extension__ ({ \
- mpfr_ptr _p = (_f); \
- _p->_mpfr_sign = 1; \
- _p->_mpfr_exp = __MPFR_EXP_ZERO; \
- (void) (_r); 0; }) : \
- mpfr_set_ui_2exp ((_f), (_u), 0, (_r)))
+#define mpfr_set_ui(_f,_u,_r) \
+ (__builtin_constant_p (_u) && (unsigned long) (_u) == 0 ? \
+ __extension__ ({ \
+ mpfr_ptr _p = (_f); \
+ _p->_mpfr_sign = 1; \
+ _p->_mpfr_exp = __MPFR_EXP_ZERO; \
+ (void) (_r); 0; }) : \
+ mpfr_set_ui_2exp ((_f), (unsigned long) (_u), 0, (_r)))
#endif
#undef mpfr_set_si
-#define mpfr_set_si(_f,_s,_r) \
- (__builtin_constant_p (_s) && (_s) >= 0 ? \
- mpfr_set_ui ((_f), (_s), (_r)) : \
- mpfr_set_si_2exp ((_f), (_s), 0, (_r)))
+#define mpfr_set_si(_f,_s,_r) \
+ (__builtin_constant_p (_s) && (long) (_s) >= 0 ? \
+ mpfr_set_ui ((_f), (unsigned long) (long) (_s), (_r)) : \
+ mpfr_set_si_2exp ((_f), (long) (_s), 0, (_r)))
#endif
#endif
diff -Naurd mpfr-3.0.0-a/tests/tcmp_ui.c mpfr-3.0.0-b/tests/tcmp_ui.c
--- mpfr-3.0.0-a/tests/tcmp_ui.c 2010-06-10 11:00:13.000000000 +0000
+++ mpfr-3.0.0-b/tests/tcmp_ui.c 2010-09-07 08:45:12.000000000 +0000
@@ -88,6 +88,126 @@
mpfr_clear (x);
}
+/* Since mpfr_cmp_ui and mpfr_cmp_si are also implemented by a macro
+ with __builtin_constant_p for GCC, check that side effects are
+ handled correctly. */
+static void
+check_macros (void)
+{
+ mpfr_t x;
+ int c;
+
+ mpfr_init2 (x, 32);
+
+ c = 0;
+ mpfr_set_ui (x, 17, MPFR_RNDN);
+ if (mpfr_cmp_ui (x, 17) != 0)
+ {
+ printf ("Error 1 on mpfr_cmp_ui(x,17) in check_macros\n");
+ exit (1);
+ }
+ if (mpfr_cmp_ui (x, (c++, 17)) != 0)
+ {
+ printf ("Error 2 on mpfr_cmp_ui(x,17) in check_macros\n");
+ exit (1);
+ }
+ if (c != 1)
+ {
+ printf ("Error 3 on mpfr_cmp_ui(x,17) in check_macros\n"
+ "(c = %d instead of 1)\n", c);
+ exit (1);
+ }
+ if (mpfr_cmp_si (x, 17) != 0)
+ {
+ printf ("Error 1 on mpfr_cmp_si(x,17) in check_macros\n");
+ exit (1);
+ }
+ if (mpfr_cmp_si (x, (c++, 17)) != 0)
+ {
+ printf ("Error 2 on mpfr_cmp_si(x,17) in check_macros\n");
+ exit (1);
+ }
+ if (c != 2)
+ {
+ printf ("Error 3 on mpfr_cmp_si(x,17) in check_macros\n"
+ "(c = %d instead of 2)\n", c);
+ exit (1);
+ }
+
+ c = 0;
+ mpfr_set_ui (x, 0, MPFR_RNDN);
+ if (mpfr_cmp_ui (x, 0) != 0)
+ {
+ printf ("Error 1 on mpfr_cmp_ui(x,0) in check_macros\n");
+ exit (1);
+ }
+ if (mpfr_cmp_ui (x, (c++, 0)) != 0)
+ {
+ printf ("Error 2 on mpfr_cmp_ui(x,0) in check_macros\n");
+ exit (1);
+ }
+ if (c != 1)
+ {
+ printf ("Error 3 on mpfr_cmp_ui(x,0) in check_macros\n"
+ "(c = %d instead of 1)\n", c);
+ exit (1);
+ }
+ if (mpfr_cmp_si (x, 0) != 0)
+ {
+ printf ("Error 1 on mpfr_cmp_si(x,0) in check_macros\n");
+ exit (1);
+ }
+ if (mpfr_cmp_si (x, (c++, 0)) != 0)
+ {
+ printf ("Error 2 on mpfr_cmp_si(x,0) in check_macros\n");
+ exit (1);
+ }
+ if (c != 2)
+ {
+ printf ("Error 3 on mpfr_cmp_si(x,0) in check_macros\n"
+ "(c = %d instead of 2)\n", c);
+ exit (1);
+ }
+
+ mpfr_clear (x);
+}
+
+/* Bug in r7114 */
+static void
+test_macros (void)
+{
+ mpfr_t x[3];
+ mpfr_ptr p;
+
+ mpfr_inits (x[0], x[1], x[2], (mpfr_ptr) 0);
+ mpfr_set_ui (x[0], 0, MPFR_RNDN);
+ p = x[0];
+ if (mpfr_cmp_ui (p++, 0) != 0)
+ {
+ printf ("Error in mpfr_cmp_ui macro: result should be 0.\n");
+ exit (1);
+ }
+ if (p != x[1])
+ {
+ printf ("Error in mpfr_cmp_ui macro: p - x[0] = %d (expecting 1)\n",
+ (int) (p - x[0]));
+ exit (1);
+ }
+ p = x[0];
+ if (mpfr_cmp_si (p++, 0) != 0)
+ {
+ printf ("Error in mpfr_cmp_si macro: result should be 0.\n");
+ exit (1);
+ }
+ if (p != x[1])
+ {
+ printf ("Error in mpfr_cmp_si macro: p - x[0] = %d (expecting 1)\n",
+ (int) (p - x[0]));
+ exit (1);
+ }
+ mpfr_clears (x[0], x[1], x[2], (mpfr_ptr) 0);
+}
+
int
main (void)
{
@@ -216,6 +336,8 @@
mpfr_clear (x);
check_nan ();
+ check_macros ();
+ test_macros ();
tests_end_mpfr ();
return 0;
diff -Naurd mpfr-3.0.0-a/version.c mpfr-3.0.0-b/version.c
--- mpfr-3.0.0-a/version.c 2010-07-10 00:11:53.000000000 +0000
+++ mpfr-3.0.0-b/version.c 2010-09-07 08:46:06.000000000 +0000
@@ -25,5 +25,5 @@
const char *
mpfr_get_version (void)
{
- return "3.0.0-p3";
+ return "3.0.0-p4";
}

View File

@ -1,45 +0,0 @@
diff -Naurd mpfr-3.0.0-a/PATCHES mpfr-3.0.0-b/PATCHES
--- mpfr-3.0.0-a/PATCHES 2010-10-21 20:28:38.000000000 +0000
+++ mpfr-3.0.0-b/PATCHES 2010-10-21 20:28:38.000000000 +0000
@@ -0,0 +1 @@
+tcan_round
diff -Naurd mpfr-3.0.0-a/VERSION mpfr-3.0.0-b/VERSION
--- mpfr-3.0.0-a/VERSION 2010-09-07 08:46:06.000000000 +0000
+++ mpfr-3.0.0-b/VERSION 2010-10-21 20:28:38.000000000 +0000
@@ -1 +1 @@
-3.0.0-p4
+3.0.0-p5
diff -Naurd mpfr-3.0.0-a/mpfr.h mpfr-3.0.0-b/mpfr.h
--- mpfr-3.0.0-a/mpfr.h 2010-09-07 08:46:06.000000000 +0000
+++ mpfr-3.0.0-b/mpfr.h 2010-10-21 20:28:38.000000000 +0000
@@ -27,7 +27,7 @@
#define MPFR_VERSION_MAJOR 3
#define MPFR_VERSION_MINOR 0
#define MPFR_VERSION_PATCHLEVEL 0
-#define MPFR_VERSION_STRING "3.0.0-p4"
+#define MPFR_VERSION_STRING "3.0.0-p5"
/* Macros dealing with MPFR VERSION */
#define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
diff -Naurd mpfr-3.0.0-a/tests/tcan_round.c mpfr-3.0.0-b/tests/tcan_round.c
--- mpfr-3.0.0-a/tests/tcan_round.c 2010-06-10 11:00:13.000000000 +0000
+++ mpfr-3.0.0-b/tests/tcan_round.c 2010-10-21 20:28:38.000000000 +0000
@@ -41,7 +41,7 @@
/* avoid mpn_random which leaks memory */
for (i = 0; i < n; i++)
buf[i] = randlimb ();
- p = (mpfr_prec_t) randlimb() % ((n-1) * GMP_NUMB_BITS) + MPFR_PREC_MIN;
+ p = randlimb() % ((n-1) * GMP_NUMB_BITS) + MPFR_PREC_MIN;
err = p + randlimb () % GMP_NUMB_BITS;
r1 = mpfr_round_p (buf, n, err, p);
r2 = mpfr_can_round_raw (buf, n, MPFR_SIGN_POS, err,
diff -Naurd mpfr-3.0.0-a/version.c mpfr-3.0.0-b/version.c
--- mpfr-3.0.0-a/version.c 2010-09-07 08:46:06.000000000 +0000
+++ mpfr-3.0.0-b/version.c 2010-10-21 20:28:38.000000000 +0000
@@ -25,5 +25,5 @@
const char *
mpfr_get_version (void)
{
- return "3.0.0-p4";
+ return "3.0.0-p5";
}

View File

@ -1,628 +0,0 @@
diff -Naurd mpfr-3.0.0-a/PATCHES mpfr-3.0.0-b/PATCHES
--- mpfr-3.0.0-a/PATCHES 2010-10-21 20:59:32.000000000 +0000
+++ mpfr-3.0.0-b/PATCHES 2010-10-21 20:59:32.000000000 +0000
@@ -0,0 +1 @@
+mpfr_sub1
diff -Naurd mpfr-3.0.0-a/VERSION mpfr-3.0.0-b/VERSION
--- mpfr-3.0.0-a/VERSION 2010-10-21 20:28:38.000000000 +0000
+++ mpfr-3.0.0-b/VERSION 2010-10-21 20:59:32.000000000 +0000
@@ -1 +1 @@
-3.0.0-p5
+3.0.0-p6
diff -Naurd mpfr-3.0.0-a/mpfr.h mpfr-3.0.0-b/mpfr.h
--- mpfr-3.0.0-a/mpfr.h 2010-10-21 20:28:38.000000000 +0000
+++ mpfr-3.0.0-b/mpfr.h 2010-10-21 20:59:32.000000000 +0000
@@ -27,7 +27,7 @@
#define MPFR_VERSION_MAJOR 3
#define MPFR_VERSION_MINOR 0
#define MPFR_VERSION_PATCHLEVEL 0
-#define MPFR_VERSION_STRING "3.0.0-p5"
+#define MPFR_VERSION_STRING "3.0.0-p6"
/* Macros dealing with MPFR VERSION */
#define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
diff -Naurd mpfr-3.0.0-a/sub1.c mpfr-3.0.0-b/sub1.c
--- mpfr-3.0.0-a/sub1.c 2010-06-10 11:00:14.000000000 +0000
+++ mpfr-3.0.0-b/sub1.c 2010-10-21 20:59:32.000000000 +0000
@@ -37,7 +37,9 @@
mp_size_t cancel2, an, bn, cn, cn0;
mp_limb_t *ap, *bp, *cp;
mp_limb_t carry, bb, cc, borrow = 0;
- int inexact, shift_b, shift_c, is_exact = 1, down = 0, add_exp = 0;
+ int inexact, shift_b, shift_c, add_exp = 0;
+ int cmp_low = 0; /* used for rounding to nearest: 0 if low(b) = low(c),
+ negative if low(b) < low(c), positive if low(b)>low(c) */
int sh, k;
MPFR_TMP_DECL(marker);
@@ -196,7 +198,8 @@
}
#ifdef DEBUG
- printf ("shift_b=%d shift_c=%d diffexp=%lu\n", shift_b, shift_c,
+ printf ("rnd=%s shift_b=%d shift_c=%d diffexp=%lu\n",
+ mpfr_print_rnd_mode (rnd_mode), shift_b, shift_c,
(unsigned long) diff_exp);
#endif
@@ -307,17 +310,18 @@
{
if (MPFR_LIKELY(sh))
{
- is_exact = (carry == 0);
/* can decide except when carry = 2^(sh-1) [middle]
or carry = 0 [truncate, but cannot decide inexact flag] */
- down = (carry < (MPFR_LIMB_ONE << (sh - 1)));
if (carry > (MPFR_LIMB_ONE << (sh - 1)))
goto add_one_ulp;
- else if ((0 < carry) && down)
+ else if ((0 < carry) && (carry < (MPFR_LIMB_ONE << (sh - 1))))
{
inexact = -1; /* result if smaller than exact value */
goto truncate;
}
+ /* now carry = 2^(sh-1), in which case cmp_low=2,
+ or carry = 0, in which case cmp_low=0 */
+ cmp_low = (carry == 0) ? 0 : 2;
}
}
else /* directed rounding: set rnd_mode to RNDZ iff toward zero */
@@ -344,12 +348,32 @@
cn -= (long int) an + cancel2;
#ifdef DEBUG
- printf ("last %d bits from a are %lu, bn=%ld, cn=%ld\n",
+ printf ("last sh=%d bits from a are %lu, bn=%ld, cn=%ld\n",
sh, (unsigned long) carry, (long) bn, (long) cn);
#endif
+ /* for rounding to nearest, we couldn't conclude up to here in the following
+ cases:
+ 1. sh = 0, then cmp_low=0: we can either truncate, subtract one ulp
+ or add one ulp: -1 ulp < low(b)-low(c) < 1 ulp
+ 2. sh > 0 but the low sh bits from high(b)-high(c) equal 2^(sh-1):
+ -0.5 ulp <= -1/2^sh < low(b)-low(c)-0.5 < 1/2^sh <= 0.5 ulp
+ we can't decide the rounding, in that case cmp_low=2:
+ either we truncate and flag=-1, or we add one ulp and flag=1
+ 3. the low sh>0 bits from high(b)-high(c) equal 0: we know we have to
+ truncate but we can't decide the ternary value, here cmp_low=0:
+ -0.5 ulp <= -1/2^sh < low(b)-low(c) < 1/2^sh <= 0.5 ulp
+ we always truncate and inexact can be any of -1,0,1
+ */
+
+ /* note: here cn might exceed cn0, in which case we consider a zero limb */
for (k = 0; (bn > 0) || (cn > 0); k = 1)
{
+ /* if cmp_low < 0, we know low(b) - low(c) < 0
+ if cmp_low > 0, we know low(b) - low(c) > 0
+ (more precisely if cmp_low = 2, low(b) - low(c) = 0.5 ulp so far)
+ if cmp_low = 0, so far low(b) - low(c) = 0 */
+
/* get next limbs */
bb = (bn > 0) ? bp[--bn] : 0;
if ((cn > 0) && (cn-- <= cn0))
@@ -357,76 +381,115 @@
else
cc = 0;
- /* down is set when low(b) < low(c) */
- if (down == 0)
- down = (bb < cc);
+ /* cmp_low compares low(b) and low(c) */
+ if (cmp_low == 0) /* case 1 or 3 */
+ cmp_low = (bb < cc) ? -2+k : (bb > cc) ? 1 : 0;
+
+ /* Case 1 for k=0 splits into 7 subcases:
+ 1a: bb > cc + half
+ 1b: bb = cc + half
+ 1c: 0 < bb - cc < half
+ 1d: bb = cc
+ 1e: -half < bb - cc < 0
+ 1f: bb - cc = -half
+ 1g: bb - cc < -half
+
+ Case 2 splits into 3 subcases:
+ 2a: bb > cc
+ 2b: bb = cc
+ 2c: bb < cc
+
+ Case 3 splits into 3 subcases:
+ 3a: bb > cc
+ 3b: bb = cc
+ 3c: bb < cc
+ */
/* the case rounding to nearest with sh=0 is special since one couldn't
subtract above 1/2 ulp in the trailing limb of the result */
- if ((rnd_mode == MPFR_RNDN) && sh == 0 && k == 0)
+ if (rnd_mode == MPFR_RNDN && sh == 0 && k == 0) /* case 1 for k=0 */
{
mp_limb_t half = MPFR_LIMB_HIGHBIT;
- is_exact = (bb == cc);
-
/* add one ulp if bb > cc + half
truncate if cc - half < bb < cc + half
sub one ulp if bb < cc - half
*/
- if (down)
+ if (cmp_low < 0) /* bb < cc: -1 ulp < low(b) - low(c) < 0,
+ cases 1e, 1f and 1g */
{
if (cc >= half)
cc -= half;
- else
+ else /* since bb < cc < half, bb+half < 2*half */
bb += half;
+ /* now we have bb < cc + half:
+ we have to subtract one ulp if bb < cc,
+ and truncate if bb > cc */
}
- else /* bb >= cc */
+ else if (cmp_low >= 0) /* bb >= cc, cases 1a to 1d */
{
if (cc < half)
cc += half;
- else
+ else /* since bb >= cc >= half, bb - half >= 0 */
bb -= half;
+ /* now we have bb > cc - half: we have to add one ulp if bb > cc,
+ and truncate if bb < cc */
+ if (cmp_low > 0)
+ cmp_low = 2;
}
}
#ifdef DEBUG
- printf (" bb=%lu cc=%lu down=%d is_exact=%d\n",
- (unsigned long) bb, (unsigned long) cc, down, is_exact);
+ printf ("k=%u bb=%lu cc=%lu cmp_low=%d\n", k,
+ (unsigned long) bb, (unsigned long) cc, cmp_low);
#endif
- if (bb < cc)
+ if (cmp_low < 0) /* low(b) - low(c) < 0: either truncate or subtract
+ one ulp */
{
if (rnd_mode == MPFR_RNDZ)
- goto sub_one_ulp;
+ goto sub_one_ulp; /* set inexact=-1 */
else if (rnd_mode != MPFR_RNDN) /* round away */
{
inexact = 1;
goto truncate;
}
- else /* round to nearest: special case here since for sh=k=0
- bb = bb0 - MPFR_LIMB_HIGHBIT */
+ else /* round to nearest */
{
- if (is_exact && sh == 0)
- {
- /* For k=0 we can't decide exactness since it may depend
- from low order bits.
- For k=1, the first low limbs matched: low(b)-low(c)<0. */
- if (k)
- {
- inexact = 1;
- goto truncate;
- }
- }
- else if (down && sh == 0)
- goto sub_one_ulp;
- else
- {
- inexact = (is_exact) ? 1 : -1;
+ /* If cmp_low < 0 and bb > cc, then -0.5 ulp < low(b)-low(c) < 0,
+ whatever the value of sh.
+ If sh>0, then cmp_low < 0 implies that the initial neglected
+ sh bits were 0 (otherwise cmp_low=2 initially), thus the
+ weight of the new bits is less than 0.5 ulp too.
+ If k > 0 (and sh=0) this means that either the first neglected
+ limbs bb and cc were equal (thus cmp_low was 0 for k=0),
+ or we had bb - cc = -0.5 ulp or 0.5 ulp.
+ The last case is not possible here since we would have
+ cmp_low > 0 which is sticky.
+ In the first case (where we have cmp_low = -1), we truncate,
+ whereas in the 2nd case we have cmp_low = -2 and we subtract
+ one ulp.
+ */
+ if (bb > cc || sh > 0 || cmp_low == -1)
+ { /* -0.5 ulp < low(b)-low(c) < 0,
+ bb > cc corresponds to cases 1e and 1f1
+ sh > 0 corresponds to cases 3c and 3b3
+ cmp_low = -1 corresponds to case 1d3 (also 3b3) */
+ inexact = 1;
goto truncate;
}
+ else if (bb < cc) /* here sh = 0 and low(b)-low(c) < -0.5 ulp,
+ this corresponds to cases 1g and 1f3 */
+ goto sub_one_ulp;
+ /* the only case where we can't conclude is sh=0 and bb=cc,
+ i.e., we have low(b) - low(c) = -0.5 ulp (up to now), thus
+ we don't know if we must truncate or subtract one ulp.
+ Note: for sh=0 we can't have low(b) - low(c) = -0.5 ulp up to
+ now, since low(b) - low(c) > 1/2^sh */
}
}
- else if (bb > cc)
+ else if (cmp_low > 0) /* 0 < low(b) - low(c): either truncate or
+ add one ulp */
{
if (rnd_mode == MPFR_RNDZ)
{
@@ -437,34 +500,70 @@
goto add_one_ulp;
else /* round to nearest */
{
- if (is_exact)
+ if (bb > cc)
{
- inexact = -1;
- goto truncate;
+ /* if sh=0, then bb>cc means that low(b)-low(c) > 0.5 ulp,
+ and similarly when cmp_low=2 */
+ if (cmp_low == 2) /* cases 1a, 1b1, 2a and 2b1 */
+ goto add_one_ulp;
+ /* sh > 0 and cmp_low > 0: this implies that the sh initial
+ neglected bits were 0, and the remaining low(b)-low(c)>0,
+ but its weight is less than 0.5 ulp */
+ else /* 0 < low(b) - low(c) < 0.5 ulp, this corresponds to
+ cases 3a, 1d1 and 3b1 */
+ {
+ inexact = -1;
+ goto truncate;
+ }
}
- else if (down)
+ else if (bb < cc) /* 0 < low(b) - low(c) < 0.5 ulp, cases 1c,
+ 1b3, 2b3 and 2c */
{
- inexact = 1;
+ inexact = -1;
goto truncate;
}
- else
- goto add_one_ulp;
+ /* the only case where we can't conclude is bb=cc, i.e.,
+ low(b) - low(c) = 0.5 ulp (up to now), thus we don't know
+ if we must truncate or add one ulp. */
}
}
+ /* after k=0, we cannot conclude in the following cases, we split them
+ according to the values of bb and cc for k=1:
+ 1b. sh=0 and cmp_low = 1 and bb-cc = half [around 0.5 ulp]
+ 1b1. bb > cc: add one ulp, inex = 1
+ 1b2: bb = cc: cannot conclude
+ 1b3: bb < cc: truncate, inex = -1
+ 1d. sh=0 and cmp_low = 0 and bb-cc = 0 [around 0]
+ 1d1: bb > cc: truncate, inex = -1
+ 1d2: bb = cc: cannot conclude
+ 1d3: bb < cc: truncate, inex = +1
+ 1f. sh=0 and cmp_low = -1 and bb-cc = -half [around -0.5 ulp]
+ 1f1: bb > cc: truncate, inex = +1
+ 1f2: bb = cc: cannot conclude
+ 1f3: bb < cc: sub one ulp, inex = -1
+ 2b. sh > 0 and cmp_low = 2 and bb=cc [around 0.5 ulp]
+ 2b1. bb > cc: add one ulp, inex = 1
+ 2b2: bb = cc: cannot conclude
+ 2b3: bb < cc: truncate, inex = -1
+ 3b. sh > 0 and cmp_low = 0 [around 0]
+ 3b1. bb > cc: truncate, inex = -1
+ 3b2: bb = cc: cannot conclude
+ 3b3: bb < cc: truncate, inex = +1
+ */
}
- if ((rnd_mode == MPFR_RNDN) && !is_exact)
+ if ((rnd_mode == MPFR_RNDN) && cmp_low != 0)
{
/* even rounding rule */
if ((ap[0] >> sh) & 1)
{
- if (down)
+ if (cmp_low < 0)
goto sub_one_ulp;
else
goto add_one_ulp;
}
else
- inexact = (down) ? 1 : -1;
+ inexact = (cmp_low > 0) ? -1 : 1;
}
else
inexact = 0;
diff -Naurd mpfr-3.0.0-a/tests/tfma.c mpfr-3.0.0-b/tests/tfma.c
--- mpfr-3.0.0-a/tests/tfma.c 2010-06-10 11:00:13.000000000 +0000
+++ mpfr-3.0.0-b/tests/tfma.c 2010-10-21 20:59:32.000000000 +0000
@@ -337,6 +337,94 @@
mpfr_clears (x, y, z, r, (mpfr_ptr) 0);
}
+static void
+bug20101018 (void)
+{
+ mpfr_t x, y, z, t, u;
+ int i;
+
+ mpfr_init2 (x, 64);
+ mpfr_init2 (y, 64);
+ mpfr_init2 (z, 64);
+ mpfr_init2 (t, 64);
+ mpfr_init2 (u, 64);
+
+ mpfr_set_str (x, "0xf.fffffffffffffffp-14766", 16, MPFR_RNDN);
+ mpfr_set_str (y, "-0xf.fffffffffffffffp+317", 16, MPFR_RNDN);
+ mpfr_set_str (z, "0x8.3ffffffffffe3ffp-14443", 16, MPFR_RNDN);
+ mpfr_set_str (t, "0x8.7ffffffffffc7ffp-14444", 16, MPFR_RNDN);
+ i = mpfr_fma (u, x, y, z, MPFR_RNDN);
+ if (mpfr_cmp (u, t) != 0)
+ {
+ printf ("Wrong result in bug20101018 (a)\n");
+ printf ("Expected ");
+ mpfr_out_str (stdout, 16, 0, t, MPFR_RNDN);
+ printf ("\nGot ");
+ mpfr_out_str (stdout, 16, 0, u, MPFR_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+ if (i <= 0)
+ {
+ printf ("Wrong ternary value in bug20101018 (a)\n");
+ printf ("Expected > 0\n");
+ printf ("Got %d\n", i);
+ exit (1);
+ }
+
+ mpfr_set_str (x, "-0xf.fffffffffffffffp-11420", 16, MPFR_RNDN);
+ mpfr_set_str (y, "0xf.fffffffffffffffp+9863", 16, MPFR_RNDN);
+ mpfr_set_str (z, "0x8.fffff80ffffffffp-1551", 16, MPFR_RNDN);
+ mpfr_set_str (t, "0x9.fffff01ffffffffp-1552", 16, MPFR_RNDN);
+ i = mpfr_fma (u, x, y, z, MPFR_RNDN);
+ if (mpfr_cmp (u, t) != 0)
+ {
+ printf ("Wrong result in bug20101018 (b)\n");
+ printf ("Expected ");
+ mpfr_out_str (stdout, 16, 0, t, MPFR_RNDN);
+ printf ("\nGot ");
+ mpfr_out_str (stdout, 16, 0, u, MPFR_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+ if (i <= 0)
+ {
+ printf ("Wrong ternary value in bug20101018 (b)\n");
+ printf ("Expected > 0\n");
+ printf ("Got %d\n", i);
+ exit (1);
+ }
+
+ mpfr_set_str (x, "0xf.fffffffffffffffp-2125", 16, MPFR_RNDN);
+ mpfr_set_str (y, "-0xf.fffffffffffffffp-6000", 16, MPFR_RNDN);
+ mpfr_set_str (z, "0x8p-8119", 16, MPFR_RNDN);
+ mpfr_set_str (t, "0x8.000000000000001p-8120", 16, MPFR_RNDN);
+ i = mpfr_fma (u, x, y, z, MPFR_RNDN);
+ if (mpfr_cmp (u, t) != 0)
+ {
+ printf ("Wrong result in bug20101018 (c)\n");
+ printf ("Expected ");
+ mpfr_out_str (stdout, 16, 0, t, MPFR_RNDN);
+ printf ("\nGot ");
+ mpfr_out_str (stdout, 16, 0, u, MPFR_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+ if (i <= 0)
+ {
+ printf ("Wrong ternary value in bug20101018 (c)\n");
+ printf ("Expected > 0\n");
+ printf ("Got %d\n", i);
+ exit (1);
+ }
+
+ mpfr_clear (x);
+ mpfr_clear (y);
+ mpfr_clear (z);
+ mpfr_clear (t);
+ mpfr_clear (u);
+}
+
int
main (int argc, char *argv[])
{
@@ -345,6 +433,8 @@
tests_start_mpfr ();
+ bug20101018 ();
+
mpfr_init (x);
mpfr_init (s);
mpfr_init (y);
diff -Naurd mpfr-3.0.0-a/tests/tsub.c mpfr-3.0.0-b/tests/tsub.c
--- mpfr-3.0.0-a/tests/tsub.c 2010-06-10 11:00:13.000000000 +0000
+++ mpfr-3.0.0-b/tests/tsub.c 2010-10-21 20:59:32.000000000 +0000
@@ -201,6 +201,8 @@
if (mpfr_cmp (z, x))
{
printf ("Error in mpfr_sub (2)\n");
+ printf ("Expected "); mpfr_print_binary (x); puts ("");
+ printf ("Got "); mpfr_print_binary (z); puts ("");
exit (1);
}
mpfr_set_str_binary (x, "1.1110111011110001110111011111111111101000011001011100101100101101");
@@ -478,6 +480,156 @@
mpfr_clear (u);
}
+/* Bug found by Jakub Jelinek
+ * http://bugzilla.redhat.com/643657
+ * https://gforge.inria.fr/tracker/index.php?func=detail&aid=11301
+ * The consequence can be either an assertion failure (i = 2 in the
+ * testcase below, in debug mode) or an incorrectly rounded value.
+ */
+static void
+bug20101017 (void)
+{
+ mpfr_t a, b, c;
+ int inex;
+ int i;
+
+ mpfr_init2 (a, GMP_NUMB_BITS * 2);
+ mpfr_init2 (b, GMP_NUMB_BITS);
+ mpfr_init2 (c, GMP_NUMB_BITS);
+
+ /* a = 2^(2N) + k.2^(2N-1) + 2^N and b = 1
+ with N = GMP_NUMB_BITS and k = 0 or 1.
+ c = a - b should round to the same value as a. */
+
+ for (i = 2; i <= 3; i++)
+ {
+ mpfr_set_ui_2exp (a, i, GMP_NUMB_BITS - 1, MPFR_RNDN);
+ mpfr_add_ui (a, a, 1, MPFR_RNDN);
+ mpfr_mul_2ui (a, a, GMP_NUMB_BITS, MPFR_RNDN);
+ mpfr_set_ui (b, 1, MPFR_RNDN);
+ inex = mpfr_sub (c, a, b, MPFR_RNDN);
+ mpfr_set (b, a, MPFR_RNDN);
+ if (! mpfr_equal_p (c, b))
+ {
+ printf ("Error in bug20101017 for i = %d.\n", i);
+ printf ("Expected ");
+ mpfr_out_str (stdout, 16, 0, b, MPFR_RNDN);
+ putchar ('\n');
+ printf ("Got ");
+ mpfr_out_str (stdout, 16, 0, c, MPFR_RNDN);
+ putchar ('\n');
+ exit (1);
+ }
+ if (inex >= 0)
+ {
+ printf ("Error in bug20101017 for i = %d: bad inex value.\n", i);
+ printf ("Expected negative, got %d.\n", inex);
+ exit (1);
+ }
+ }
+
+ mpfr_set_prec (a, 64);
+ mpfr_set_prec (b, 129);
+ mpfr_set_prec (c, 2);
+ mpfr_set_str_binary (b, "0.100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001E65");
+ mpfr_set_str_binary (c, "0.10E1");
+ inex = mpfr_sub (a, b, c, MPFR_RNDN);
+ if (mpfr_cmp_ui_2exp (a, 1, 64) != 0 || inex >= 0)
+ {
+ printf ("Error in mpfr_sub for b-c for b=2^64+1+2^(-64), c=1\n");
+ printf ("Expected result 2^64 with inex < 0\n");
+ printf ("Got "); mpfr_print_binary (a);
+ printf (" with inex=%d\n", inex);
+ exit (1);
+ }
+
+ mpfr_clears (a, b, c, (mpfr_ptr) 0);
+}
+
+/* hard test of rounding */
+static void
+check_rounding (void)
+{
+ mpfr_t a, b, c, res;
+ mpfr_prec_t p;
+ long k, l;
+ int i;
+
+#define MAXKL (2 * GMP_NUMB_BITS)
+ for (p = MPFR_PREC_MIN; p <= GMP_NUMB_BITS; p++)
+ {
+ mpfr_init2 (a, p);
+ mpfr_init2 (res, p);
+ mpfr_init2 (b, p + 1 + MAXKL);
+ mpfr_init2 (c, MPFR_PREC_MIN);
+
+ /* b = 2^p + 1 + 2^(-k), c = 2^(-l) */
+ for (k = 0; k <= MAXKL; k++)
+ for (l = 0; l <= MAXKL; l++)
+ {
+ mpfr_set_ui_2exp (b, 1, p, MPFR_RNDN);
+ mpfr_add_ui (b, b, 1, MPFR_RNDN);
+ mpfr_mul_2ui (b, b, k, MPFR_RNDN);
+ mpfr_add_ui (b, b, 1, MPFR_RNDN);
+ mpfr_div_2ui (b, b, k, MPFR_RNDN);
+ mpfr_set_ui_2exp (c, 1, -l, MPFR_RNDN);
+ i = mpfr_sub (a, b, c, MPFR_RNDN);
+ /* b - c = 2^p + 1 + 2^(-k) - 2^(-l), should be rounded to
+ 2^p for l <= k, and 2^p+2 for l < k */
+ if (l <= k)
+ {
+ if (mpfr_cmp_ui_2exp (a, 1, p) != 0)
+ {
+ printf ("Wrong result in check_rounding\n");
+ printf ("p=%lu k=%ld l=%ld\n", p, k, l);
+ printf ("b="); mpfr_print_binary (b); puts ("");
+ printf ("c="); mpfr_print_binary (c); puts ("");
+ printf ("Expected 2^%lu\n", p);
+ printf ("Got "); mpfr_print_binary (a); puts ("");
+ exit (1);
+ }
+ if (i >= 0)
+ {
+ printf ("Wrong ternary value in check_rounding\n");
+ printf ("p=%lu k=%ld l=%ld\n", p, k, l);
+ printf ("b="); mpfr_print_binary (b); puts ("");
+ printf ("c="); mpfr_print_binary (c); puts ("");
+ printf ("a="); mpfr_print_binary (a); puts ("");
+ printf ("Expected < 0, got %d\n", i);
+ exit (1);
+ }
+ }
+ else /* l < k */
+ {
+ mpfr_set_ui_2exp (res, 1, p, MPFR_RNDN);
+ mpfr_add_ui (res, res, 2, MPFR_RNDN);
+ if (mpfr_cmp (a, res) != 0)
+ {
+ printf ("Wrong result in check_rounding\n");
+ printf ("b="); mpfr_print_binary (b); puts ("");
+ printf ("c="); mpfr_print_binary (c); puts ("");
+ printf ("Expected "); mpfr_print_binary (res); puts ("");
+ printf ("Got "); mpfr_print_binary (a); puts ("");
+ exit (1);
+ }
+ if (i <= 0)
+ {
+ printf ("Wrong ternary value in check_rounding\n");
+ printf ("b="); mpfr_print_binary (b); puts ("");
+ printf ("c="); mpfr_print_binary (c); puts ("");
+ printf ("Expected > 0, got %d\n", i);
+ exit (1);
+ }
+ }
+ }
+
+ mpfr_clear (a);
+ mpfr_clear (res);
+ mpfr_clear (b);
+ mpfr_clear (c);
+ }
+}
+
#define TEST_FUNCTION test_sub
#define TWO_ARGS
#define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), randlimb () % 100, RANDS)
@@ -491,6 +643,8 @@
tests_start_mpfr ();
+ bug20101017 ();
+ check_rounding ();
check_diverse ();
check_inexact ();
bug_ddefour ();
diff -Naurd mpfr-3.0.0-a/version.c mpfr-3.0.0-b/version.c
--- mpfr-3.0.0-a/version.c 2010-10-21 20:28:38.000000000 +0000
+++ mpfr-3.0.0-b/version.c 2010-10-21 20:59:32.000000000 +0000
@@ -25,5 +25,5 @@
const char *
mpfr_get_version (void)
{
- return "3.0.0-p5";
+ return "3.0.0-p6";
}

View File

@ -1,155 +0,0 @@
diff -Naurd mpfr-3.0.0-a/PATCHES mpfr-3.0.0-b/PATCHES
--- mpfr-3.0.0-a/PATCHES 2010-10-21 21:18:26.000000000 +0000
+++ mpfr-3.0.0-b/PATCHES 2010-10-21 21:18:26.000000000 +0000
@@ -0,0 +1 @@
+mpfr_set_ld
diff -Naurd mpfr-3.0.0-a/VERSION mpfr-3.0.0-b/VERSION
--- mpfr-3.0.0-a/VERSION 2010-10-21 20:59:32.000000000 +0000
+++ mpfr-3.0.0-b/VERSION 2010-10-21 21:18:26.000000000 +0000
@@ -1 +1 @@
-3.0.0-p6
+3.0.0-p7
diff -Naurd mpfr-3.0.0-a/mpfr.h mpfr-3.0.0-b/mpfr.h
--- mpfr-3.0.0-a/mpfr.h 2010-10-21 20:59:32.000000000 +0000
+++ mpfr-3.0.0-b/mpfr.h 2010-10-21 21:18:26.000000000 +0000
@@ -27,7 +27,7 @@
#define MPFR_VERSION_MAJOR 3
#define MPFR_VERSION_MINOR 0
#define MPFR_VERSION_PATCHLEVEL 0
-#define MPFR_VERSION_STRING "3.0.0-p6"
+#define MPFR_VERSION_STRING "3.0.0-p7"
/* Macros dealing with MPFR VERSION */
#define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
diff -Naurd mpfr-3.0.0-a/set_ld.c mpfr-3.0.0-b/set_ld.c
--- mpfr-3.0.0-a/set_ld.c 2010-06-10 11:00:14.000000000 +0000
+++ mpfr-3.0.0-b/set_ld.c 2010-10-21 21:18:26.000000000 +0000
@@ -102,21 +102,25 @@
{
x /= div13; /* exact */
shift_exp += 8192;
+ mpfr_div_2si (t, t, 8192, MPFR_RNDZ);
}
if (ABS (x) >= div12)
{
x /= div12; /* exact */
shift_exp += 4096;
+ mpfr_div_2si (t, t, 4096, MPFR_RNDZ);
}
if (ABS (x) >= div11)
{
x /= div11; /* exact */
shift_exp += 2048;
+ mpfr_div_2si (t, t, 2048, MPFR_RNDZ);
}
if (ABS (x) >= div10)
{
x /= div10; /* exact */
shift_exp += 1024;
+ mpfr_div_2si (t, t, 1024, MPFR_RNDZ);
}
/* warning: we may have DBL_MAX=2^1024*(1-2^(-53)) < x < 2^1024,
therefore we have one extra exponent reduction step */
@@ -124,9 +128,10 @@
{
x /= div9; /* exact */
shift_exp += 512;
+ mpfr_div_2si (t, t, 512, MPFR_RNDZ);
}
} /* Check overflow of double */
- else
+ else /* no overflow on double */
{
long double div9, div10, div11;
@@ -149,29 +154,34 @@
{
x /= div13; /* exact */
shift_exp -= 8192;
+ mpfr_mul_2si (t, t, 8192, MPFR_RNDZ);
}
if (ABS (x) <= div12)
{
x /= div12; /* exact */
shift_exp -= 4096;
+ mpfr_mul_2si (t, t, 4096, MPFR_RNDZ);
}
if (ABS (x) <= div11)
{
x /= div11; /* exact */
shift_exp -= 2048;
+ mpfr_mul_2si (t, t, 2048, MPFR_RNDZ);
}
if (ABS (x) <= div10)
{
x /= div10; /* exact */
shift_exp -= 1024;
+ mpfr_mul_2si (t, t, 1024, MPFR_RNDZ);
}
if (ABS(x) <= div9)
{
x /= div9; /* exact */
shift_exp -= 512;
+ mpfr_mul_2si (t, t, 512, MPFR_RNDZ);
}
}
- else
+ else /* no underflow */
{
inexact = mpfr_set_d (u, (double) x, MPFR_RNDZ);
MPFR_ASSERTD (inexact == 0);
diff -Naurd mpfr-3.0.0-a/tests/tset_ld.c mpfr-3.0.0-b/tests/tset_ld.c
--- mpfr-3.0.0-a/tests/tset_ld.c 2010-06-10 11:00:13.000000000 +0000
+++ mpfr-3.0.0-b/tests/tset_ld.c 2010-10-21 21:18:26.000000000 +0000
@@ -147,12 +147,39 @@
test_fixed_bugs (void)
{
mpfr_t x;
- long double d;
+ long double l, m;
/* bug found by Steve Kargl (2009-03-14) */
mpfr_init2 (x, 64);
mpfr_set_ui_2exp (x, 1, -16447, MPFR_RNDN);
- d = mpfr_get_ld (x, MPFR_RNDN); /* an assertion failed in init2.c:50 */
+ mpfr_get_ld (x, MPFR_RNDN); /* an assertion failed in init2.c:50 */
+
+ /* bug reported by Jakub Jelinek (2010-10-17)
+ https://gforge.inria.fr/tracker/?func=detail&aid=11300 */
+ mpfr_set_prec (x, MPFR_LDBL_MANT_DIG);
+ /* l = 0x1.23456789abcdef0123456789abcdp-914L; */
+ l = 8.215640181713713164092636634579e-276;
+ mpfr_set_ld (x, l, MPFR_RNDN);
+ m = mpfr_get_ld (x, MPFR_RNDN);
+ if (m != l)
+ {
+ printf ("Error in get_ld o set_ld for l=%Le\n", l);
+ printf ("Got m=%Le instead of l\n", m);
+ exit (1);
+ }
+
+ /* another similar test which failed with extended double precision and the
+ generic code for mpfr_set_ld */
+ /* l = 0x1.23456789abcdef0123456789abcdp-968L; */
+ l = 4.560596445887084662336528403703e-292;
+ mpfr_set_ld (x, l, MPFR_RNDN);
+ m = mpfr_get_ld (x, MPFR_RNDN);
+ if (m != l)
+ {
+ printf ("Error in get_ld o set_ld for l=%Le\n", l);
+ printf ("Got m=%Le instead of l\n", m);
+ exit (1);
+ }
mpfr_clear (x);
}
diff -Naurd mpfr-3.0.0-a/version.c mpfr-3.0.0-b/version.c
--- mpfr-3.0.0-a/version.c 2010-10-21 20:59:32.000000000 +0000
+++ mpfr-3.0.0-b/version.c 2010-10-21 21:18:26.000000000 +0000
@@ -25,5 +25,5 @@
const char *
mpfr_get_version (void)
{
- return "3.0.0-p6";
+ return "3.0.0-p7";
}

View File

@ -1,193 +0,0 @@
diff -Naurd mpfr-3.0.0-a/PATCHES mpfr-3.0.0-b/PATCHES
--- mpfr-3.0.0-a/PATCHES 2010-11-09 15:15:07.000000000 +0000
+++ mpfr-3.0.0-b/PATCHES 2010-11-09 15:15:07.000000000 +0000
@@ -0,0 +1 @@
+macros
diff -Naurd mpfr-3.0.0-a/VERSION mpfr-3.0.0-b/VERSION
--- mpfr-3.0.0-a/VERSION 2010-10-21 21:18:26.000000000 +0000
+++ mpfr-3.0.0-b/VERSION 2010-11-09 15:15:07.000000000 +0000
@@ -1 +1 @@
-3.0.0-p7
+3.0.0-p8
diff -Naurd mpfr-3.0.0-a/mpfr.h mpfr-3.0.0-b/mpfr.h
--- mpfr-3.0.0-a/mpfr.h 2010-10-21 21:18:26.000000000 +0000
+++ mpfr-3.0.0-b/mpfr.h 2010-11-09 15:15:07.000000000 +0000
@@ -27,7 +27,7 @@
#define MPFR_VERSION_MAJOR 3
#define MPFR_VERSION_MINOR 0
#define MPFR_VERSION_PATCHLEVEL 0
-#define MPFR_VERSION_STRING "3.0.0-p7"
+#define MPFR_VERSION_STRING "3.0.0-p8"
/* Macros dealing with MPFR VERSION */
#define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
@@ -67,6 +67,16 @@
# define _MPFR_H_HAVE_INTMAX_T 1
#endif
+/* Avoid some problems with macro expansion if the user defines macros
+ with the same name as keywords. By convention, identifiers and macro
+ names starting with mpfr_ are reserved by MPFR. */
+typedef void mpfr_void;
+typedef int mpfr_int;
+typedef unsigned int mpfr_uint;
+typedef long mpfr_long;
+typedef unsigned long mpfr_ulong;
+typedef size_t mpfr_size_t;
+
/* Definition of rounding modes (DON'T USE MPFR_RNDNA!).
Warning! Changing the contents of this enum should be seen as an
interface change since the old and the new types are not compatible
@@ -136,7 +146,7 @@
typedef mp_exp_t mpfr_exp_t;
/* Definition of the standard exponent limits */
-#define MPFR_EMAX_DEFAULT ((mpfr_exp_t) (((unsigned long) 1 << 30) - 1))
+#define MPFR_EMAX_DEFAULT ((mpfr_exp_t) (((mpfr_ulong) 1 << 30) - 1))
#define MPFR_EMIN_DEFAULT (-(MPFR_EMAX_DEFAULT))
/* Definition of the main structure */
@@ -725,13 +735,13 @@
unexpected results with future compilers and aggressive optimisations.
Why not working only with signed types, using INT_MIN and LONG_MIN? */
#if __GMP_MP_SIZE_T_INT
-#define __MPFR_EXP_NAN ((mpfr_exp_t)((~((~(unsigned int)0)>>1))+2))
-#define __MPFR_EXP_ZERO ((mpfr_exp_t)((~((~(unsigned int)0)>>1))+1))
-#define __MPFR_EXP_INF ((mpfr_exp_t)((~((~(unsigned int)0)>>1))+3))
+#define __MPFR_EXP_NAN ((mpfr_exp_t)((~((~(mpfr_uint)0)>>1))+2))
+#define __MPFR_EXP_ZERO ((mpfr_exp_t)((~((~(mpfr_uint)0)>>1))+1))
+#define __MPFR_EXP_INF ((mpfr_exp_t)((~((~(mpfr_uint)0)>>1))+3))
#else
-#define __MPFR_EXP_NAN ((mpfr_exp_t)((~((~(unsigned long)0)>>1))+2))
-#define __MPFR_EXP_ZERO ((mpfr_exp_t)((~((~(unsigned long)0)>>1))+1))
-#define __MPFR_EXP_INF ((mpfr_exp_t)((~((~(unsigned long)0)>>1))+3))
+#define __MPFR_EXP_NAN ((mpfr_exp_t)((~((~(mpfr_ulong)0)>>1))+2))
+#define __MPFR_EXP_ZERO ((mpfr_exp_t)((~((~(mpfr_ulong)0)>>1))+1))
+#define __MPFR_EXP_INF ((mpfr_exp_t)((~((~(mpfr_ulong)0)>>1))+3))
#endif
/* Define MPFR_USE_EXTENSION to avoid "gcc -pedantic" warnings. */
@@ -760,9 +770,9 @@
#define mpfr_inf_p(_x) ((_x)->_mpfr_exp == __MPFR_EXP_INF)
#define mpfr_zero_p(_x) ((_x)->_mpfr_exp == __MPFR_EXP_ZERO)
#define mpfr_regular_p(_x) ((_x)->_mpfr_exp > __MPFR_EXP_INF)
-#define mpfr_sgn(_x) \
- ((_x)->_mpfr_exp < __MPFR_EXP_INF ? \
- (mpfr_nan_p (_x) ? mpfr_set_erangeflag () : (void) 0), 0 : \
+#define mpfr_sgn(_x) \
+ ((_x)->_mpfr_exp < __MPFR_EXP_INF ? \
+ (mpfr_nan_p (_x) ? mpfr_set_erangeflag () : (mpfr_void) 0), 0 : \
MPFR_SIGN (_x))
/* Prevent them from using as lvalues */
@@ -805,7 +815,19 @@
Moreover casts to unsigned long have been added to avoid warnings in
programs that use MPFR and are compiled with -Wconversion; such casts
are OK since if X is a constant expression, then (unsigned long) X is
- also a constant expression, so that the optimizations still work. */
+ also a constant expression, so that the optimizations still work. The
+ warnings are probably related to the following two bugs:
+ http://gcc.gnu.org/bugzilla/show_bug.cgi?id=4210
+ http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38470 (possibly a variant)
+ and the casts could be removed once these bugs are fixed.
+ Casts shouldn't be used on the generic calls (to the ..._2exp functions),
+ where implicit conversions are performed. Indeed, having at least one
+ implicit conversion in the macro allows the compiler to emit diagnostics
+ when normally expected, for instance in the following call:
+ mpfr_set_ui (x, "foo", MPFR_RNDN);
+ If this is not possible (for future macros), one of the tricks described
+ on http://groups.google.com/group/comp.std.c/msg/e92abd24bf9eaf7b could
+ be used. */
#if defined (__GNUC__) && !defined(__ICC) && !defined(__cplusplus)
#if (__GNUC__ >= 2)
#undef mpfr_cmp_ui
@@ -813,45 +835,45 @@
But warning! mpfr_sgn is specified as a macro in the API, thus the macro
mustn't be used if side effects are possible, like here. */
#define mpfr_cmp_ui(_f,_u) \
- (__builtin_constant_p (_u) && (unsigned long) (_u) == 0 ? \
+ (__builtin_constant_p (_u) && (mpfr_ulong) (_u) == 0 ? \
(mpfr_sgn) (_f) : \
- mpfr_cmp_ui_2exp ((_f), (unsigned long) (_u), 0))
+ mpfr_cmp_ui_2exp ((_f), (_u), 0))
#undef mpfr_cmp_si
-#define mpfr_cmp_si(_f,_s) \
- (__builtin_constant_p (_s) && (long) (_s) >= 0 ? \
- mpfr_cmp_ui ((_f), (unsigned long) (long) (_s)) : \
- mpfr_cmp_si_2exp ((_f), (long) (_s), 0))
+#define mpfr_cmp_si(_f,_s) \
+ (__builtin_constant_p (_s) && (mpfr_long) (_s) >= 0 ? \
+ mpfr_cmp_ui ((_f), (mpfr_ulong) (mpfr_long) (_s)) : \
+ mpfr_cmp_si_2exp ((_f), (_s), 0))
#if __GNUC__ > 2 || __GNUC_MINOR__ >= 95
#undef mpfr_set_ui
#define mpfr_set_ui(_f,_u,_r) \
- (__builtin_constant_p (_u) && (unsigned long) (_u) == 0 ? \
+ (__builtin_constant_p (_u) && (mpfr_ulong) (_u) == 0 ? \
__extension__ ({ \
mpfr_ptr _p = (_f); \
_p->_mpfr_sign = 1; \
_p->_mpfr_exp = __MPFR_EXP_ZERO; \
- (void) (_r); 0; }) : \
- mpfr_set_ui_2exp ((_f), (unsigned long) (_u), 0, (_r)))
+ (mpfr_void) (_r); 0; }) : \
+ mpfr_set_ui_2exp ((_f), (_u), 0, (_r)))
#endif
#undef mpfr_set_si
#define mpfr_set_si(_f,_s,_r) \
- (__builtin_constant_p (_s) && (long) (_s) >= 0 ? \
- mpfr_set_ui ((_f), (unsigned long) (long) (_s), (_r)) : \
- mpfr_set_si_2exp ((_f), (long) (_s), 0, (_r)))
+ (__builtin_constant_p (_s) && (mpfr_long) (_s) >= 0 ? \
+ mpfr_set_ui ((_f), (mpfr_ulong) (mpfr_long) (_s), (_r)) : \
+ mpfr_set_si_2exp ((_f), (_s), 0, (_r)))
#endif
#endif
/* Macro version of mpfr_stack interface for fast access */
-#define mpfr_custom_get_size(p) ((size_t) \
+#define mpfr_custom_get_size(p) ((mpfr_size_t) \
(((p)+GMP_NUMB_BITS-1)/GMP_NUMB_BITS*sizeof (mp_limb_t)))
#define mpfr_custom_init(m,p) do {} while (0)
-#define mpfr_custom_get_significand(x) ((void*)((x)->_mpfr_d))
+#define mpfr_custom_get_significand(x) ((mpfr_void*)((x)->_mpfr_d))
#define mpfr_custom_get_exp(x) ((x)->_mpfr_exp)
#define mpfr_custom_move(x,m) do { ((x)->_mpfr_d = (mp_limb_t*)(m)); } while (0)
#define mpfr_custom_init_set(x,k,e,p,m) do { \
mpfr_ptr _x = (x); \
mpfr_exp_t _e; \
mpfr_kind_t _t; \
- int _s, _k; \
+ mpfr_int _s, _k; \
_k = (k); \
if (_k >= 0) { \
_t = (mpfr_kind_t) _k; \
@@ -868,11 +890,13 @@
_x->_mpfr_exp = _e; \
_x->_mpfr_d = (mp_limb_t*) (m); \
} while (0)
-#define mpfr_custom_get_kind(x) \
- ( (x)->_mpfr_exp > __MPFR_EXP_INF ? (int)MPFR_REGULAR_KIND*MPFR_SIGN (x) \
- : (x)->_mpfr_exp == __MPFR_EXP_INF ? (int)MPFR_INF_KIND*MPFR_SIGN (x) \
- : (x)->_mpfr_exp == __MPFR_EXP_NAN ? (int)MPFR_NAN_KIND \
- : (int) MPFR_ZERO_KIND * MPFR_SIGN (x) )
+#define mpfr_custom_get_kind(x) \
+ ( (x)->_mpfr_exp > __MPFR_EXP_INF ? \
+ (mpfr_int) MPFR_REGULAR_KIND * MPFR_SIGN (x) \
+ : (x)->_mpfr_exp == __MPFR_EXP_INF ? \
+ (mpfr_int) MPFR_INF_KIND * MPFR_SIGN (x) \
+ : (x)->_mpfr_exp == __MPFR_EXP_NAN ? (mpfr_int) MPFR_NAN_KIND \
+ : (mpfr_int) MPFR_ZERO_KIND * MPFR_SIGN (x) )
#endif /* MPFR_USE_NO_MACRO */
diff -Naurd mpfr-3.0.0-a/version.c mpfr-3.0.0-b/version.c
--- mpfr-3.0.0-a/version.c 2010-10-21 21:18:26.000000000 +0000
+++ mpfr-3.0.0-b/version.c 2010-11-09 15:15:07.000000000 +0000
@@ -25,5 +25,5 @@
const char *
mpfr_get_version (void)
{
- return "3.0.0-p7";
+ return "3.0.0-p8";
}

View File

@ -1 +0,0 @@
obsolete='yes'

View File

@ -1,50 +0,0 @@
diff -Naurd mpfr-3.1.0-a/PATCHES mpfr-3.1.0-b/PATCHES
--- mpfr-3.1.0-a/PATCHES 2011-10-05 21:39:57.000000000 +0000
+++ mpfr-3.1.0-b/PATCHES 2011-10-05 21:39:57.000000000 +0000
@@ -0,0 +1 @@
+mpfr_unlikely
diff -Naurd mpfr-3.1.0-a/VERSION mpfr-3.1.0-b/VERSION
--- mpfr-3.1.0-a/VERSION 2011-10-03 08:17:15.000000000 +0000
+++ mpfr-3.1.0-b/VERSION 2011-10-05 21:39:57.000000000 +0000
@@ -1 +1 @@
-3.1.0
+3.1.0-p1
diff -Naurd mpfr-3.1.0-a/src/mpfr-impl.h mpfr-3.1.0-b/src/mpfr-impl.h
--- mpfr-3.1.0-a/src/mpfr-impl.h 2011-10-03 08:17:09.000000000 +0000
+++ mpfr-3.1.0-b/src/mpfr-impl.h 2011-10-05 21:39:57.000000000 +0000
@@ -988,10 +988,11 @@
******************************************************/
/* Theses macros help the compiler to determine if a test is
- * likely or unlikely. */
+ likely or unlikely. The !! is necessary in case x is larger
+ than a long. */
#if __MPFR_GNUC(3,0) || __MPFR_ICC(8,1,0)
# define MPFR_LIKELY(x) (__builtin_expect(!!(x),1))
-# define MPFR_UNLIKELY(x) (__builtin_expect((x),0))
+# define MPFR_UNLIKELY(x) (__builtin_expect(!!(x),0))
#else
# define MPFR_LIKELY(x) (x)
# define MPFR_UNLIKELY(x) (x)
diff -Naurd mpfr-3.1.0-a/src/mpfr.h mpfr-3.1.0-b/src/mpfr.h
--- mpfr-3.1.0-a/src/mpfr.h 2011-10-03 08:17:09.000000000 +0000
+++ mpfr-3.1.0-b/src/mpfr.h 2011-10-05 21:39:57.000000000 +0000
@@ -27,7 +27,7 @@
#define MPFR_VERSION_MAJOR 3
#define MPFR_VERSION_MINOR 1
#define MPFR_VERSION_PATCHLEVEL 0
-#define MPFR_VERSION_STRING "3.1.0"
+#define MPFR_VERSION_STRING "3.1.0-p1"
/* Macros dealing with MPFR VERSION */
#define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
diff -Naurd mpfr-3.1.0-a/src/version.c mpfr-3.1.0-b/src/version.c
--- mpfr-3.1.0-a/src/version.c 2011-10-03 08:17:09.000000000 +0000
+++ mpfr-3.1.0-b/src/version.c 2011-10-05 21:39:57.000000000 +0000
@@ -25,5 +25,5 @@
const char *
mpfr_get_version (void)
{
- return "3.1.0";
+ return "3.1.0-p1";
}

View File

@ -1,96 +0,0 @@
diff -Naurd mpfr-3.1.0-a/PATCHES mpfr-3.1.0-b/PATCHES
--- mpfr-3.1.0-a/PATCHES 2011-10-14 10:43:32.000000000 +0000
+++ mpfr-3.1.0-b/PATCHES 2011-10-14 10:43:32.000000000 +0000
@@ -0,0 +1 @@
+lib-search-path
diff -Naurd mpfr-3.1.0-a/VERSION mpfr-3.1.0-b/VERSION
--- mpfr-3.1.0-a/VERSION 2011-10-05 21:39:57.000000000 +0000
+++ mpfr-3.1.0-b/VERSION 2011-10-14 10:43:32.000000000 +0000
@@ -1 +1 @@
-3.1.0-p1
+3.1.0-p2
diff -Naurd mpfr-3.1.0-a/src/mpfr.h mpfr-3.1.0-b/src/mpfr.h
--- mpfr-3.1.0-a/src/mpfr.h 2011-10-05 21:39:57.000000000 +0000
+++ mpfr-3.1.0-b/src/mpfr.h 2011-10-14 10:43:32.000000000 +0000
@@ -27,7 +27,7 @@
#define MPFR_VERSION_MAJOR 3
#define MPFR_VERSION_MINOR 1
#define MPFR_VERSION_PATCHLEVEL 0
-#define MPFR_VERSION_STRING "3.1.0-p1"
+#define MPFR_VERSION_STRING "3.1.0-p2"
/* Macros dealing with MPFR VERSION */
#define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
diff -Naurd mpfr-3.1.0-a/src/version.c mpfr-3.1.0-b/src/version.c
--- mpfr-3.1.0-a/src/version.c 2011-10-05 21:39:57.000000000 +0000
+++ mpfr-3.1.0-b/src/version.c 2011-10-14 10:43:32.000000000 +0000
@@ -25,5 +25,5 @@
const char *
mpfr_get_version (void)
{
- return "3.1.0-p1";
+ return "3.1.0-p2";
}
diff -Naurd mpfr-3.1.0-a/tests/Makefile.am mpfr-3.1.0-b/tests/Makefile.am
--- mpfr-3.1.0-a/tests/Makefile.am 2011-10-03 08:17:14.000000000 +0000
+++ mpfr-3.1.0-b/tests/Makefile.am 2011-10-03 08:17:14.000000000 +0000
@@ -65,8 +65,24 @@
TESTS = $(check_PROGRAMS)
TESTS_ENVIRONMENT = MPFR_QUIET=1 $(VALGRIND)
-# Option to prevent libtool from generating wrapper scripts for the tests.
+# The -no-install option prevents libtool from generating wrapper scripts
+# for the tests.
# This is useful to easily run the test scripts under valgrind or gdb.
# See discussion http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/28033
# http://article.gmane.org/gmane.comp.lib.gnulib.bugs/28140 in particular.
-AM_LDFLAGS = -no-install
+#
+# The -L$(top_builddir)/src/.libs option is necessary for some platforms,
+# such as HP-UX, when --with-gmp or --with-gmp-lib is used and an old MPFR
+# library is already installed in the corresponding lib directory: its
+# purpose is to make sure that the local .libs comes first in the library
+# search path (otherwise the tests are linked against the old MPFR library
+# by the LINK command -- see the generated Makefile). See:
+# http://websympa.loria.fr/wwsympa/arc/mpfr/2011-10/msg00042.html
+# http://websympa.loria.fr/wwsympa/arc/mpfr/2011-10/msg00043.html
+# http://websympa.loria.fr/wwsympa/arc/mpfr/2011-10/msg00044.html
+# http://websympa.loria.fr/wwsympa/arc/mpfr/2011-10/msg00066.html
+# http://websympa.loria.fr/wwsympa/arc/mpfr/2011-10/msg00065.html
+# and
+# http://debbugs.gnu.org/cgi/bugreport.cgi?bug=9728
+#
+AM_LDFLAGS = -no-install -L$(top_builddir)/src/.libs
diff -Naurd mpfr-3.1.0-a/tests/Makefile.in mpfr-3.1.0-b/tests/Makefile.in
--- mpfr-3.1.0-a/tests/Makefile.in 2011-10-03 08:17:35.000000000 +0000
+++ mpfr-3.1.0-b/tests/Makefile.in 2011-10-03 08:17:35.000000000 +0000
@@ -1124,11 +1124,27 @@
TESTS = $(check_PROGRAMS)
TESTS_ENVIRONMENT = MPFR_QUIET=1 $(VALGRIND)
-# Option to prevent libtool from generating wrapper scripts for the tests.
+# The -no-install option prevents libtool from generating wrapper scripts
+# for the tests.
# This is useful to easily run the test scripts under valgrind or gdb.
# See discussion http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/28033
# http://article.gmane.org/gmane.comp.lib.gnulib.bugs/28140 in particular.
-AM_LDFLAGS = -no-install
+#
+# The -L$(top_builddir)/src/.libs option is necessary for some platforms,
+# such as HP-UX, when --with-gmp or --with-gmp-lib is used and an old MPFR
+# library is already installed in the corresponding lib directory: its
+# purpose is to make sure that the local .libs comes first in the library
+# search path (otherwise the tests are linked against the old MPFR library
+# by the LINK command -- see the generated Makefile). See:
+# http://websympa.loria.fr/wwsympa/arc/mpfr/2011-10/msg00042.html
+# http://websympa.loria.fr/wwsympa/arc/mpfr/2011-10/msg00043.html
+# http://websympa.loria.fr/wwsympa/arc/mpfr/2011-10/msg00044.html
+# http://websympa.loria.fr/wwsympa/arc/mpfr/2011-10/msg00066.html
+# http://websympa.loria.fr/wwsympa/arc/mpfr/2011-10/msg00065.html
+# and
+# http://debbugs.gnu.org/cgi/bugreport.cgi?bug=9728
+#
+AM_LDFLAGS = -no-install -L$(top_builddir)/src/.libs
all: all-am
.SUFFIXES:

View File

@ -1,247 +0,0 @@
diff -Naurd mpfr-3.1.0-a/PATCHES mpfr-3.1.0-b/PATCHES
--- mpfr-3.1.0-a/PATCHES 2011-11-03 15:15:11.000000000 +0000
+++ mpfr-3.1.0-b/PATCHES 2011-11-03 15:15:11.000000000 +0000
@@ -0,0 +1 @@
+vasprintf
diff -Naurd mpfr-3.1.0-a/VERSION mpfr-3.1.0-b/VERSION
--- mpfr-3.1.0-a/VERSION 2011-10-14 10:43:32.000000000 +0000
+++ mpfr-3.1.0-b/VERSION 2011-11-03 15:15:11.000000000 +0000
@@ -1 +1 @@
-3.1.0-p2
+3.1.0-p3
diff -Naurd mpfr-3.1.0-a/src/mpfr.h mpfr-3.1.0-b/src/mpfr.h
--- mpfr-3.1.0-a/src/mpfr.h 2011-10-14 10:43:32.000000000 +0000
+++ mpfr-3.1.0-b/src/mpfr.h 2011-11-03 15:15:11.000000000 +0000
@@ -27,7 +27,7 @@
#define MPFR_VERSION_MAJOR 3
#define MPFR_VERSION_MINOR 1
#define MPFR_VERSION_PATCHLEVEL 0
-#define MPFR_VERSION_STRING "3.1.0-p2"
+#define MPFR_VERSION_STRING "3.1.0-p3"
/* Macros dealing with MPFR VERSION */
#define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
diff -Naurd mpfr-3.1.0-a/src/vasprintf.c mpfr-3.1.0-b/src/vasprintf.c
--- mpfr-3.1.0-a/src/vasprintf.c 2011-10-03 08:17:09.000000000 +0000
+++ mpfr-3.1.0-b/src/vasprintf.c 2011-11-03 15:15:11.000000000 +0000
@@ -1178,7 +1178,7 @@
mpfr_exp_t exp;
char * str;
const int spec_g = (spec.spec == 'g' || spec.spec == 'G');
- const int keep_trailing_zeros = spec_g && spec.alt;
+ const int keep_trailing_zeros = !spec_g || spec.alt;
/* WARNING: an empty precision field is forbidden (it means precision = 6
and it should have been changed to 6 before the function call) */
@@ -1356,7 +1356,7 @@
else
/* 1 <= |p| */
{
- size_t nsd; /* Number of significant digits */
+ size_t str_len;
/* Determine the position of the most significant decimal digit. */
exp = floor_log10 (p);
@@ -1365,12 +1365,10 @@
/* P is too large to print all its integral part digits */
return -1;
- np->ip_size = exp + 1;
-
- nsd = spec.prec + np->ip_size;
if (dec_info == NULL)
- {
- str = mpfr_get_str (NULL, &exp, 10, nsd, p, spec.rnd_mode);
+ { /* this case occurs with mpfr_printf ("%.0RUf", x) with x=9.5 */
+ str =
+ mpfr_get_str (NULL, &exp, 10, spec.prec+exp+1, p, spec.rnd_mode);
register_string (np->sl, str);
}
else
@@ -1379,81 +1377,60 @@
str = dec_info->str;
}
np->ip_ptr = MPFR_IS_NEG (p) ? ++str : str; /* skip sign */
+ str_len = strlen (str);
+
+ /* integral part */
+ if (exp > str_len)
+ /* mpfr_get_str gives no trailing zero when p is rounded up to the next
+ power of 10 (p integer, so no fractional part) */
+ {
+ np->ip_trailing_zeros = exp - str_len;
+ np->ip_size = str_len;
+ }
+ else
+ np->ip_size = exp;
if (spec.group)
/* thousands separator in integral part */
np->thousands_sep = MPFR_THOUSANDS_SEPARATOR;
- if (nsd == 0 || (spec_g && !spec.alt))
- /* compute how much non-zero digits in integral and fractional
- parts */
+ /* fractional part */
+ str += np->ip_size;
+ str_len -= np->ip_size;
+ if (!keep_trailing_zeros)
+ /* remove trailing zeros, if any */
{
- size_t str_len;
- str_len = strlen (str); /* note: the sign has been skipped */
-
- if (exp > str_len)
- /* mpfr_get_str doesn't give the trailing zeros when p is a
- multiple of 10 (p integer, so no fractional part) */
- {
- np->ip_trailing_zeros = exp - str_len;
- np->ip_size = str_len;
- if (spec.alt)
- np->point = MPFR_DECIMAL_POINT;
- }
- else
- /* str may contain some digits which are in fractional part */
+ char *ptr = str + str_len - 1; /* pointer to the last digit of
+ str */
+ while ((*ptr == '0') && (str_len != 0))
{
- char *ptr;
-
- ptr = str + str_len - 1; /* points to the end of str */
- str_len -= np->ip_size; /* number of digits in fractional
- part */
-
- if (!keep_trailing_zeros)
- /* remove trailing zeros, if any */
- {
- while ((*ptr == '0') && (str_len != 0))
- {
- --ptr;
- --str_len;
- }
- }
-
- if (str_len > INT_MAX)
- /* too many digits in fractional part */
- return -1;
-
- if (str_len != 0)
- /* some digits in fractional part */
- {
- np->point = MPFR_DECIMAL_POINT;
- np->fp_ptr = str + np->ip_size;
- np->fp_size = str_len;
- }
+ --ptr;
+ --str_len;
}
}
- else
- /* spec.prec digits in fractional part */
+
+ if (str_len > 0)
+ /* some nonzero digits in fractional part */
{
- if (np->ip_size == exp - 1)
- /* the absolute value of the number has been rounded up to a power
- of ten.
- Insert an additional zero in integral part and put the rest of
- them in fractional part. */
- np->ip_trailing_zeros = 1;
+ if (str_len > INT_MAX)
+ /* too many digits in fractional part */
+ return -1;
- if (spec.prec != 0)
- {
- MPFR_ASSERTD (np->ip_size + np->ip_trailing_zeros == exp);
- MPFR_ASSERTD (np->ip_size + spec.prec == nsd);
+ np->point = MPFR_DECIMAL_POINT;
+ np->fp_ptr = str;
+ np->fp_size = str_len;
+ }
- np->point = MPFR_DECIMAL_POINT;
- np->fp_ptr = str + np->ip_size;
- np->fp_size = spec.prec;
- }
- else if (spec.alt)
- np->point = MPFR_DECIMAL_POINT;
+ if (keep_trailing_zeros && str_len < spec.prec)
+ /* add missing trailing zeros */
+ {
+ np->point = MPFR_DECIMAL_POINT;
+ np->fp_trailing_zeros = spec.prec - np->fp_size;
}
+
+ if (spec.alt)
+ /* add decimal point even if no digits follow it */
+ np->point = MPFR_DECIMAL_POINT;
}
return 0;
diff -Naurd mpfr-3.1.0-a/src/version.c mpfr-3.1.0-b/src/version.c
--- mpfr-3.1.0-a/src/version.c 2011-10-14 10:43:32.000000000 +0000
+++ mpfr-3.1.0-b/src/version.c 2011-11-03 15:15:11.000000000 +0000
@@ -25,5 +25,5 @@
const char *
mpfr_get_version (void)
{
- return "3.1.0-p2";
+ return "3.1.0-p3";
}
diff -Naurd mpfr-3.1.0-a/tests/tsprintf.c mpfr-3.1.0-b/tests/tsprintf.c
--- mpfr-3.1.0-a/tests/tsprintf.c 2011-10-03 08:17:14.000000000 +0000
+++ mpfr-3.1.0-b/tests/tsprintf.c 2011-11-03 15:15:11.000000000 +0000
@@ -475,6 +475,18 @@
check_sprintf ("-1.", "%- #0.1RG", x);
/* precision zero */
+ mpfr_set_d (x, 9.5, MPFR_RNDN);
+ check_sprintf ("9", "%.0RDf", x);
+ check_sprintf ("10", "%.0RUf", x);
+
+ mpfr_set_d (x, 19.5, MPFR_RNDN);
+ check_sprintf ("19", "%.0RDf", x);
+ check_sprintf ("20", "%.0RUf", x);
+
+ mpfr_set_d (x, 99.5, MPFR_RNDN);
+ check_sprintf ("99", "%.0RDf", x);
+ check_sprintf ("100", "%.0RUf", x);
+
mpfr_set_d (x, -9.5, MPFR_RNDN);
check_sprintf ("-10", "%.0RDf", x);
check_sprintf ("-10", "%.0RYf", x);
@@ -1078,6 +1090,23 @@
mpfr_clear (x);
}
+static void
+bug20111102 (void)
+{
+ mpfr_t t;
+ char s[100];
+
+ mpfr_init2 (t, 84);
+ mpfr_set_str (t, "999.99999999999999999999", 10, MPFR_RNDN);
+ mpfr_sprintf (s, "%.20RNg", t);
+ if (strcmp (s, "1000") != 0)
+ {
+ printf ("Error in bug20111102, expected 1000, got %s\n", s);
+ exit (1);
+ }
+ mpfr_clear (t);
+}
+
/* In particular, the following test makes sure that the rounding
* for %Ra and %Rb is not done on the MPFR number itself (as it
* would overflow). Note: it has been reported on comp.std.c that
@@ -1161,6 +1190,7 @@
locale = setlocale (LC_ALL, "C");
#endif
+ bug20111102 ();
native_types ();
hexadecimal ();
binary ();

View File

@ -1,166 +0,0 @@
diff -Naurd mpfr-3.1.0-a/PATCHES mpfr-3.1.0-b/PATCHES
--- mpfr-3.1.0-a/PATCHES 2011-11-28 12:22:52.000000000 +0000
+++ mpfr-3.1.0-b/PATCHES 2011-11-28 12:22:52.000000000 +0000
@@ -0,0 +1 @@
+gmp41compat
diff -Naurd mpfr-3.1.0-a/VERSION mpfr-3.1.0-b/VERSION
--- mpfr-3.1.0-a/VERSION 2011-11-03 15:15:11.000000000 +0000
+++ mpfr-3.1.0-b/VERSION 2011-11-28 12:22:52.000000000 +0000
@@ -1 +1 @@
-3.1.0-p3
+3.1.0-p4
diff -Naurd mpfr-3.1.0-a/doc/mpfr.info mpfr-3.1.0-b/doc/mpfr.info
--- mpfr-3.1.0-a/doc/mpfr.info 2011-10-03 09:43:04.000000000 +0000
+++ mpfr-3.1.0-b/doc/mpfr.info 2011-11-28 12:22:52.000000000 +0000
@@ -2994,11 +2994,12 @@
* `mpfr_urandom' and `mpfr_urandomb' changed in MPFR 3.1. Their
behavior no longer depends on the platform (assuming this is also
- true for GMP's random generator). As a consequence, the returned
- values can be different between MPFR 3.1 and previous MPFR
- versions. Note: as the reproducibility of these functions was not
- specified before MPFR 3.1, the MPFR 3.1 behavior is _not_ regarded
- as backward incompatible with previous versions.
+ true for GMP's random generator, which is not the case between GMP
+ 4.1 and 4.2 if `gmp_randinit_default' is used). As a consequence,
+ the returned values can be different between MPFR 3.1 and previous
+ MPFR versions. Note: as the reproducibility of these functions
+ was not specified before MPFR 3.1, the MPFR 3.1 behavior is _not_
+ regarded as backward incompatible with previous versions.

@@ -4239,13 +4240,13 @@
Node: Type and Macro Changes129308
Node: Added Functions132029
Node: Changed Functions134972
-Node: Removed Functions139167
-Node: Other Changes139579
-Node: Contributors141108
-Node: References143574
-Node: GNU Free Documentation License145315
-Node: Concept Index167758
-Node: Function and Type Index173677
+Node: Removed Functions139253
+Node: Other Changes139665
+Node: Contributors141194
+Node: References143660
+Node: GNU Free Documentation License145401
+Node: Concept Index167844
+Node: Function and Type Index173763

End Tag Table
diff -Naurd mpfr-3.1.0-a/doc/mpfr.texi mpfr-3.1.0-b/doc/mpfr.texi
--- mpfr-3.1.0-a/doc/mpfr.texi 2011-10-03 08:17:14.000000000 +0000
+++ mpfr-3.1.0-b/doc/mpfr.texi 2011-11-28 12:22:52.000000000 +0000
@@ -3466,8 +3466,9 @@
a lack of specification.
@item @code{mpfr_urandom} and @code{mpfr_urandomb} changed in MPFR 3.1.
-Their behavior no longer depends on the platform (assuming this is also
-true for GMP's random generator). As a consequence, the returned values
+Their behavior no longer depends on the platform (assuming this is also true
+for GMP's random generator, which is not the case between GMP 4.1 and 4.2 if
+@code{gmp_randinit_default} is used). As a consequence, the returned values
can be different between MPFR 3.1 and previous MPFR versions.
Note: as the reproducibility of these functions was not specified
before MPFR 3.1, the MPFR 3.1 behavior is @emph{not} regarded as
diff -Naurd mpfr-3.1.0-a/src/mpfr.h mpfr-3.1.0-b/src/mpfr.h
--- mpfr-3.1.0-a/src/mpfr.h 2011-11-03 15:15:11.000000000 +0000
+++ mpfr-3.1.0-b/src/mpfr.h 2011-11-28 12:22:52.000000000 +0000
@@ -27,7 +27,7 @@
#define MPFR_VERSION_MAJOR 3
#define MPFR_VERSION_MINOR 1
#define MPFR_VERSION_PATCHLEVEL 0
-#define MPFR_VERSION_STRING "3.1.0-p3"
+#define MPFR_VERSION_STRING "3.1.0-p4"
/* Macros dealing with MPFR VERSION */
#define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
diff -Naurd mpfr-3.1.0-a/src/version.c mpfr-3.1.0-b/src/version.c
--- mpfr-3.1.0-a/src/version.c 2011-11-03 15:15:11.000000000 +0000
+++ mpfr-3.1.0-b/src/version.c 2011-11-28 12:22:52.000000000 +0000
@@ -25,5 +25,5 @@
const char *
mpfr_get_version (void)
{
- return "3.1.0-p3";
+ return "3.1.0-p4";
}
diff -Naurd mpfr-3.1.0-a/tests/trandom.c mpfr-3.1.0-b/tests/trandom.c
--- mpfr-3.1.0-a/tests/trandom.c 2011-10-03 08:17:14.000000000 +0000
+++ mpfr-3.1.0-b/tests/trandom.c 2011-11-28 12:22:52.000000000 +0000
@@ -114,21 +114,29 @@
mpfr_t x;
gmp_randstate_t s;
+#if __MPFR_GMP(4,2,0)
+# define C1 "0.895943"
+# define C2 "0.848824"
+#else
+# define C1 "0.479652"
+# define C2 "0.648529"
+#endif
+
gmp_randinit_default (s);
gmp_randseed_ui (s, 42);
mpfr_init2 (x, 17);
mpfr_urandomb (x, s);
- if (mpfr_cmp_str1 (x, "0.895943") != 0)
+ if (mpfr_cmp_str1 (x, C1) != 0)
{
- printf ("Error in bug20100914, expected 0.895943, got ");
+ printf ("Error in bug20100914, expected " C1 ", got ");
mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN);
printf ("\n");
exit (1);
}
mpfr_urandomb (x, s);
- if (mpfr_cmp_str1 (x, "0.848824") != 0)
+ if (mpfr_cmp_str1 (x, C2) != 0)
{
- printf ("Error in bug20100914, expected 0.848824, got ");
+ printf ("Error in bug20100914, expected " C2 ", got ");
mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN);
printf ("\n");
exit (1);
diff -Naurd mpfr-3.1.0-a/tests/turandom.c mpfr-3.1.0-b/tests/turandom.c
--- mpfr-3.1.0-a/tests/turandom.c 2011-10-03 08:17:14.000000000 +0000
+++ mpfr-3.1.0-b/tests/turandom.c 2011-11-28 12:22:52.000000000 +0000
@@ -160,23 +160,29 @@
mpfr_t x;
gmp_randstate_t s;
+#if __MPFR_GMP(4,2,0)
+# define C1 "0.8488312"
+# define C2 "0.8156509"
+#else
+# define C1 "0.6485367"
+# define C2 "0.9362717"
+#endif
+
gmp_randinit_default (s);
gmp_randseed_ui (s, 42);
mpfr_init2 (x, 17);
mpfr_urandom (x, s, MPFR_RNDN);
- /* the following values are obtained on a 32-bit computer, we should get
- the same values on a 64-bit computer */
- if (mpfr_cmp_str1 (x, "0.8488312") != 0)
+ if (mpfr_cmp_str1 (x, C1) != 0)
{
- printf ("Error in bug20100914, expected 0.8488312, got ");
+ printf ("Error in bug20100914, expected " C1 ", got ");
mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN);
printf ("\n");
exit (1);
}
mpfr_urandom (x, s, MPFR_RNDN);
- if (mpfr_cmp_str1 (x, "0.8156509") != 0)
+ if (mpfr_cmp_str1 (x, C2) != 0)
{
- printf ("Error in bug20100914, expected 0.8156509, got ");
+ printf ("Error in bug20100914, expected " C2 ", got ");
mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN);
printf ("\n");
exit (1);

View File

@ -1,69 +0,0 @@
diff -Naurd mpfr-3.1.0-a/PATCHES mpfr-3.1.0-b/PATCHES
--- mpfr-3.1.0-a/PATCHES 2012-02-24 12:44:49.000000000 +0000
+++ mpfr-3.1.0-b/PATCHES 2012-02-24 12:44:49.000000000 +0000
@@ -0,0 +1 @@
+logging-freeze
diff -Naurd mpfr-3.1.0-a/VERSION mpfr-3.1.0-b/VERSION
--- mpfr-3.1.0-a/VERSION 2011-11-28 12:22:52.000000000 +0000
+++ mpfr-3.1.0-b/VERSION 2012-02-24 12:44:49.000000000 +0000
@@ -1 +1 @@
-3.1.0-p4
+3.1.0-p5
diff -Naurd mpfr-3.1.0-a/src/add_d.c mpfr-3.1.0-b/src/add_d.c
--- mpfr-3.1.0-a/src/add_d.c 2011-10-03 08:17:09.000000000 +0000
+++ mpfr-3.1.0-b/src/add_d.c 2012-02-24 12:44:49.000000000 +0000
@@ -34,7 +34,7 @@
(("b[%Pu]=%.*Rg c=%.20g rnd=%d",
mpfr_get_prec(b), mpfr_log_prec, b, c, rnd_mode),
("a[%Pu]=%.*Rg inexact=%d",
- mpfr_get_prec (a), mpfr_get_prec, a, inexact));
+ mpfr_get_prec (a), mpfr_log_prec, a, inexact));
MPFR_SAVE_EXPO_MARK (expo);
diff -Naurd mpfr-3.1.0-a/src/add_ui.c mpfr-3.1.0-b/src/add_ui.c
--- mpfr-3.1.0-a/src/add_ui.c 2011-10-03 08:17:09.000000000 +0000
+++ mpfr-3.1.0-b/src/add_ui.c 2012-02-24 12:44:49.000000000 +0000
@@ -29,7 +29,7 @@
MPFR_LOG_FUNC
(("x[%Pu]=%.*Rg u=%d rnd=%d",
mpfr_get_prec(x), mpfr_log_prec, x, u, rnd_mode),
- ("y[%Pu]=%.*Rg", mpfr_get_prec (y), mpfr_get_prec, y));
+ ("y[%Pu]=%.*Rg", mpfr_get_prec (y), mpfr_log_prec, y));
if (MPFR_LIKELY(u != 0) ) /* if u=0, do nothing */
{
diff -Naurd mpfr-3.1.0-a/src/mpfr.h mpfr-3.1.0-b/src/mpfr.h
--- mpfr-3.1.0-a/src/mpfr.h 2011-11-28 12:22:52.000000000 +0000
+++ mpfr-3.1.0-b/src/mpfr.h 2012-02-24 12:44:49.000000000 +0000
@@ -27,7 +27,7 @@
#define MPFR_VERSION_MAJOR 3
#define MPFR_VERSION_MINOR 1
#define MPFR_VERSION_PATCHLEVEL 0
-#define MPFR_VERSION_STRING "3.1.0-p4"
+#define MPFR_VERSION_STRING "3.1.0-p5"
/* Macros dealing with MPFR VERSION */
#define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
diff -Naurd mpfr-3.1.0-a/src/mul_d.c mpfr-3.1.0-b/src/mul_d.c
--- mpfr-3.1.0-a/src/mul_d.c 2011-10-03 08:17:09.000000000 +0000
+++ mpfr-3.1.0-b/src/mul_d.c 2012-02-24 12:44:49.000000000 +0000
@@ -34,7 +34,7 @@
(("b[%Pu]=%.*Rg c=%.20g rnd=%d",
mpfr_get_prec(b), mpfr_log_prec, b, c, rnd_mode),
("a[%Pu]=%.*Rg inexact=%d",
- mpfr_get_prec (a), mpfr_get_prec, a, inexact));
+ mpfr_get_prec (a), mpfr_log_prec, a, inexact));
MPFR_SAVE_EXPO_MARK (expo);
diff -Naurd mpfr-3.1.0-a/src/version.c mpfr-3.1.0-b/src/version.c
--- mpfr-3.1.0-a/src/version.c 2011-11-28 12:22:52.000000000 +0000
+++ mpfr-3.1.0-b/src/version.c 2012-02-24 12:44:49.000000000 +0000
@@ -25,5 +25,5 @@
const char *
mpfr_get_version (void)
{
- return "3.1.0-p4";
+ return "3.1.0-p5";
}

View File

@ -1,45 +0,0 @@
diff -Naurd mpfr-3.1.0-a/PATCHES mpfr-3.1.0-b/PATCHES
--- mpfr-3.1.0-a/PATCHES 2012-02-24 13:50:05.000000000 +0000
+++ mpfr-3.1.0-b/PATCHES 2012-02-24 13:50:05.000000000 +0000
@@ -0,0 +1 @@
+logging-varfmt
diff -Naurd mpfr-3.1.0-a/VERSION mpfr-3.1.0-b/VERSION
--- mpfr-3.1.0-a/VERSION 2012-02-24 12:44:49.000000000 +0000
+++ mpfr-3.1.0-b/VERSION 2012-02-24 13:50:05.000000000 +0000
@@ -1 +1 @@
-3.1.0-p5
+3.1.0-p6
diff -Naurd mpfr-3.1.0-a/src/mpfr-impl.h mpfr-3.1.0-b/src/mpfr-impl.h
--- mpfr-3.1.0-a/src/mpfr-impl.h 2011-10-05 21:39:57.000000000 +0000
+++ mpfr-3.1.0-b/src/mpfr-impl.h 2012-02-24 13:50:05.000000000 +0000
@@ -1592,7 +1592,7 @@
do \
if ((MPFR_LOG_INTERNAL_F & mpfr_log_type) && \
(mpfr_log_current <= mpfr_log_level)) \
- LOG_PRINT ("%s.%d:%s[%#Pu]=%.*Rf\n", __func__, __LINE__, \
+ LOG_PRINT ("%s.%d:%s[%#Pu]=%.*Rg\n", __func__, __LINE__, \
#x, mpfr_get_prec (x), mpfr_log_prec, x); \
while (0)
diff -Naurd mpfr-3.1.0-a/src/mpfr.h mpfr-3.1.0-b/src/mpfr.h
--- mpfr-3.1.0-a/src/mpfr.h 2012-02-24 12:44:49.000000000 +0000
+++ mpfr-3.1.0-b/src/mpfr.h 2012-02-24 13:50:05.000000000 +0000
@@ -27,7 +27,7 @@
#define MPFR_VERSION_MAJOR 3
#define MPFR_VERSION_MINOR 1
#define MPFR_VERSION_PATCHLEVEL 0
-#define MPFR_VERSION_STRING "3.1.0-p5"
+#define MPFR_VERSION_STRING "3.1.0-p6"
/* Macros dealing with MPFR VERSION */
#define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
diff -Naurd mpfr-3.1.0-a/src/version.c mpfr-3.1.0-b/src/version.c
--- mpfr-3.1.0-a/src/version.c 2012-02-24 12:44:49.000000000 +0000
+++ mpfr-3.1.0-b/src/version.c 2012-02-24 13:50:05.000000000 +0000
@@ -25,5 +25,5 @@
const char *
mpfr_get_version (void)
{
- return "3.1.0-p5";
+ return "3.1.0-p6";
}

View File

@ -1,591 +0,0 @@
diff -Naurd mpfr-3.1.0-a/PATCHES mpfr-3.1.0-b/PATCHES
--- mpfr-3.1.0-a/PATCHES 2012-03-08 15:17:03.000000000 +0000
+++ mpfr-3.1.0-b/PATCHES 2012-03-08 15:17:03.000000000 +0000
@@ -0,0 +1 @@
+large-prec
diff -Naurd mpfr-3.1.0-a/VERSION mpfr-3.1.0-b/VERSION
--- mpfr-3.1.0-a/VERSION 2012-02-24 13:50:05.000000000 +0000
+++ mpfr-3.1.0-b/VERSION 2012-03-08 15:17:03.000000000 +0000
@@ -1 +1 @@
-3.1.0-p6
+3.1.0-p7
diff -Naurd mpfr-3.1.0-a/src/add1.c mpfr-3.1.0-b/src/add1.c
--- mpfr-3.1.0-a/src/add1.c 2011-10-03 08:17:09.000000000 +0000
+++ mpfr-3.1.0-b/src/add1.c 2012-03-08 15:17:03.000000000 +0000
@@ -44,12 +44,12 @@
bq = MPFR_PREC(b);
cq = MPFR_PREC(c);
- an = (aq-1)/GMP_NUMB_BITS+1; /* number of limbs of a */
+ an = MPFR_PREC2LIMBS (aq); /* number of limbs of a */
aq2 = (mpfr_prec_t) an * GMP_NUMB_BITS;
sh = aq2 - aq; /* non-significant bits in low limb */
- bn = (bq-1)/GMP_NUMB_BITS+1; /* number of limbs of b */
- cn = (cq-1)/GMP_NUMB_BITS+1; /* number of limbs of c */
+ bn = MPFR_PREC2LIMBS (bq); /* number of limbs of b */
+ cn = MPFR_PREC2LIMBS (cq); /* number of limbs of c */
ap = MPFR_MANT(a);
bp = MPFR_MANT(b);
@@ -124,7 +124,7 @@
dif = aq2 - diff_exp;
/* dif is the number of bits of c which overlap with a' */
- difn = (dif-1)/GMP_NUMB_BITS + 1;
+ difn = MPFR_PREC2LIMBS (dif);
/* only the highest difn limbs from c have to be considered */
if (MPFR_UNLIKELY(difn > cn))
{
diff -Naurd mpfr-3.1.0-a/src/add1sp.c mpfr-3.1.0-b/src/add1sp.c
--- mpfr-3.1.0-a/src/add1sp.c 2011-10-03 08:17:09.000000000 +0000
+++ mpfr-3.1.0-b/src/add1sp.c 2012-03-08 15:17:03.000000000 +0000
@@ -107,7 +107,7 @@
/* Read prec and num of limbs */
p = MPFR_PREC(b);
- n = (p+GMP_NUMB_BITS-1)/GMP_NUMB_BITS;
+ n = MPFR_PREC2LIMBS (p);
MPFR_UNSIGNED_MINUS_MODULO(sh, p);
bx = MPFR_GET_EXP(b);
d = (mpfr_uexp_t) (bx - MPFR_GET_EXP(c));
diff -Naurd mpfr-3.1.0-a/src/agm.c mpfr-3.1.0-b/src/agm.c
--- mpfr-3.1.0-a/src/agm.c 2011-10-03 08:17:09.000000000 +0000
+++ mpfr-3.1.0-b/src/agm.c 2012-03-08 15:17:03.000000000 +0000
@@ -91,7 +91,7 @@
q = MPFR_PREC(r);
p = q + MPFR_INT_CEIL_LOG2(q) + 15;
MPFR_ASSERTD (p >= 7); /* see algorithms.tex */
- s = (p - 1) / GMP_NUMB_BITS + 1;
+ s = MPFR_PREC2LIMBS (p);
/* b (op2) and a (op1) are the 2 operands but we want b >= a */
compare = mpfr_cmp (op1, op2);
@@ -285,7 +285,7 @@
/* Next iteration */
MPFR_ZIV_NEXT (loop, p);
- s = (p - 1) / GMP_NUMB_BITS + 1;
+ s = MPFR_PREC2LIMBS (p);
}
MPFR_ZIV_FREE (loop);
diff -Naurd mpfr-3.1.0-a/src/eq.c mpfr-3.1.0-b/src/eq.c
--- mpfr-3.1.0-a/src/eq.c 2011-10-03 08:17:09.000000000 +0000
+++ mpfr-3.1.0-b/src/eq.c 2012-03-08 15:17:03.000000000 +0000
@@ -56,8 +56,8 @@
if (uexp != vexp)
return 0; /* no bit agree */
- usize = (MPFR_PREC(u) - 1) / GMP_NUMB_BITS + 1;
- vsize = (MPFR_PREC(v) - 1) / GMP_NUMB_BITS + 1;
+ usize = MPFR_LIMB_SIZE (u);
+ vsize = MPFR_LIMB_SIZE (v);
if (vsize > usize) /* exchange u and v */
{
diff -Naurd mpfr-3.1.0-a/src/exp.c mpfr-3.1.0-b/src/exp.c
--- mpfr-3.1.0-a/src/exp.c 2011-10-03 08:17:09.000000000 +0000
+++ mpfr-3.1.0-b/src/exp.c 2012-03-08 15:17:03.000000000 +0000
@@ -133,7 +133,7 @@
mp_size_t yn;
int sh;
- yn = 1 + (MPFR_PREC(y) - 1) / GMP_NUMB_BITS;
+ yn = MPFR_LIMB_SIZE (y);
sh = (mpfr_prec_t) yn * GMP_NUMB_BITS - MPFR_PREC(y);
MPFR_MANT(y)[0] += MPFR_LIMB_ONE << sh;
inexact = 1;
diff -Naurd mpfr-3.1.0-a/src/get_d.c mpfr-3.1.0-b/src/get_d.c
--- mpfr-3.1.0-a/src/get_d.c 2011-10-03 08:17:09.000000000 +0000
+++ mpfr-3.1.0-b/src/get_d.c 2012-03-08 15:17:03.000000000 +0000
@@ -100,7 +100,7 @@
nbits += (1021 + e);
MPFR_ASSERTD (nbits >= 1);
}
- np = (nbits + GMP_NUMB_BITS - 1) / GMP_NUMB_BITS;
+ np = MPFR_PREC2LIMBS (nbits);
MPFR_ASSERTD ( np <= MPFR_LIMBS_PER_DOUBLE );
carry = mpfr_round_raw_4 (tp, MPFR_MANT(src), MPFR_PREC(src), negative,
nbits, rnd_mode);
diff -Naurd mpfr-3.1.0-a/src/get_flt.c mpfr-3.1.0-b/src/get_flt.c
--- mpfr-3.1.0-a/src/get_flt.c 2011-10-03 08:17:09.000000000 +0000
+++ mpfr-3.1.0-b/src/get_flt.c 2012-03-08 15:17:03.000000000 +0000
@@ -92,7 +92,7 @@
nbits += (125 + e);
MPFR_ASSERTD (nbits >= 1);
}
- np = (nbits + GMP_NUMB_BITS - 1) / GMP_NUMB_BITS;
+ np = MPFR_PREC2LIMBS (nbits);
MPFR_ASSERTD(np <= MPFR_LIMBS_PER_FLT);
carry = mpfr_round_raw_4 (tp, MPFR_MANT(src), MPFR_PREC(src), negative,
nbits, rnd_mode);
diff -Naurd mpfr-3.1.0-a/src/get_str.c mpfr-3.1.0-b/src/get_str.c
--- mpfr-3.1.0-a/src/get_str.c 2011-10-03 08:17:09.000000000 +0000
+++ mpfr-3.1.0-b/src/get_str.c 2012-03-08 15:17:03.000000000 +0000
@@ -2351,7 +2351,7 @@
/* the first digit will contain only r bits */
prec = (m - 1) * pow2 + r; /* total number of bits */
- n = (prec - 1) / GMP_NUMB_BITS + 1;
+ n = MPFR_PREC2LIMBS (prec);
MPFR_TMP_MARK (marker);
x1 = MPFR_TMP_LIMBS_ALLOC (n + 1);
@@ -2417,12 +2417,12 @@
exact = 1;
/* number of limbs */
- n = 1 + (prec - 1) / GMP_NUMB_BITS;
+ n = MPFR_PREC2LIMBS (prec);
/* a will contain the approximation of the mantissa */
a = MPFR_TMP_LIMBS_ALLOC (n);
- nx = 1 + (MPFR_PREC(x) - 1) / GMP_NUMB_BITS;
+ nx = MPFR_LIMB_SIZE (x);
if ((mpfr_exp_t) m == g) /* final exponent is 0, no multiplication or
division to perform */
diff -Naurd mpfr-3.1.0-a/src/init2.c mpfr-3.1.0-b/src/init2.c
--- mpfr-3.1.0-a/src/init2.c 2011-10-03 08:17:09.000000000 +0000
+++ mpfr-3.1.0-b/src/init2.c 2012-03-08 15:17:03.000000000 +0000
@@ -51,7 +51,7 @@
which both have an odd mantissa */
MPFR_ASSERTN(p >= MPFR_PREC_MIN && p <= MPFR_PREC_MAX);
- xsize = (mp_size_t) ((p - 1) / GMP_NUMB_BITS) + 1;
+ xsize = MPFR_PREC2LIMBS (p);
tmp = (mpfr_limb_ptr) (*__gmp_allocate_func)(MPFR_MALLOC_SIZE(xsize));
MPFR_PREC(x) = p; /* Set prec */
diff -Naurd mpfr-3.1.0-a/src/lngamma.c mpfr-3.1.0-b/src/lngamma.c
--- mpfr-3.1.0-a/src/lngamma.c 2011-10-03 08:17:09.000000000 +0000
+++ mpfr-3.1.0-b/src/lngamma.c 2012-03-08 15:17:03.000000000 +0000
@@ -67,7 +67,7 @@
/* Now, the unit bit is represented. */
- prec = ((prec - 1) / GMP_NUMB_BITS + 1) * GMP_NUMB_BITS - expo;
+ prec = MPFR_PREC2LIMBS (prec) * GMP_NUMB_BITS - expo;
/* number of represented fractional bits (including the trailing 0's) */
x0 = *(MPFR_MANT (x) + prec / GMP_NUMB_BITS);
diff -Naurd mpfr-3.1.0-a/src/mpfr-impl.h mpfr-3.1.0-b/src/mpfr-impl.h
--- mpfr-3.1.0-a/src/mpfr-impl.h 2012-02-24 13:50:05.000000000 +0000
+++ mpfr-3.1.0-b/src/mpfr-impl.h 2012-03-09 12:06:26.000000000 +0000
@@ -646,10 +646,24 @@
**************** mpfr_t properties *******************
******************************************************/
+/* In the following macro, p is usually a mpfr_prec_t, but this macro
+ works with other integer types (without integer overflow). Checking
+ that p >= 1 in debug mode is useful here because this macro can be
+ used on a computed precision (in particular, this formula does not
+ work for a degenerate case p = 0, and could give different results
+ on different platforms). But let us not use an assertion checking
+ in the MPFR_LAST_LIMB() and MPFR_LIMB_SIZE() macros below to avoid
+ too much expansion for assertions (in practice, this should be a
+ problem just when testing MPFR with the --enable-assert configure
+ option and the -ansi -pedantic-errors gcc compiler flags). */
+#define MPFR_PREC2LIMBS(p) \
+ (MPFR_ASSERTD ((p) >= 1), ((p) - 1) / GMP_NUMB_BITS + 1)
+
#define MPFR_PREC(x) ((x)->_mpfr_prec)
#define MPFR_EXP(x) ((x)->_mpfr_exp)
#define MPFR_MANT(x) ((x)->_mpfr_d)
-#define MPFR_LIMB_SIZE(x) ((MPFR_PREC((x))-1)/GMP_NUMB_BITS+1)
+#define MPFR_LAST_LIMB(x) ((MPFR_PREC (x) - 1) / GMP_NUMB_BITS)
+#define MPFR_LIMB_SIZE(x) (MPFR_LAST_LIMB (x) + 1)
/******************************************************
@@ -749,7 +763,8 @@
#define MPFR_IS_FP(x) (!MPFR_IS_NAN(x) && !MPFR_IS_INF(x))
#define MPFR_IS_SINGULAR(x) (MPFR_EXP(x) <= MPFR_EXP_INF)
#define MPFR_IS_PURE_FP(x) (!MPFR_IS_SINGULAR(x) && \
- (MPFR_ASSERTD (MPFR_MANT(x)[MPFR_LIMB_SIZE(x)-1] & MPFR_LIMB_HIGHBIT), 1))
+ (MPFR_ASSERTD ((MPFR_MANT(x)[MPFR_LAST_LIMB(x)] \
+ & MPFR_LIMB_HIGHBIT) != 0), 1))
#define MPFR_ARE_SINGULAR(x,y) \
(MPFR_UNLIKELY(MPFR_IS_SINGULAR(x)) || MPFR_UNLIKELY(MPFR_IS_SINGULAR(y)))
@@ -1061,7 +1076,7 @@
/* Set a number to 1 (Fast) - It doesn't check if 1 is in the exponent range */
#define MPFR_SET_ONE(x) \
do { \
- mp_size_t _size = MPFR_LIMB_SIZE(x) - 1; \
+ mp_size_t _size = MPFR_LAST_LIMB(x); \
MPFR_SET_POS(x); \
MPFR_EXP(x) = 1; \
MPN_ZERO ( MPFR_MANT(x), _size); \
@@ -1213,8 +1228,8 @@
_destp = MPFR_MANT (dest); \
if (MPFR_UNLIKELY (_destprec >= _srcprec)) \
{ \
- _srcs = (_srcprec + GMP_NUMB_BITS-1)/GMP_NUMB_BITS; \
- _dests = (_destprec + GMP_NUMB_BITS-1)/GMP_NUMB_BITS - _srcs; \
+ _srcs = MPFR_PREC2LIMBS (_srcprec); \
+ _dests = MPFR_PREC2LIMBS (_destprec) - _srcs; \
MPN_COPY (_destp + _dests, srcp, _srcs); \
MPN_ZERO (_destp, _dests); \
inexact = 0; \
@@ -1227,8 +1242,8 @@
mp_limb_t _rb, _sb, _ulp; \
\
/* Compute Position and shift */ \
- _srcs = (_srcprec + GMP_NUMB_BITS-1)/GMP_NUMB_BITS; \
- _dests = (_destprec + GMP_NUMB_BITS-1)/GMP_NUMB_BITS; \
+ _srcs = MPFR_PREC2LIMBS (_srcprec); \
+ _dests = MPFR_PREC2LIMBS (_destprec); \
MPFR_UNSIGNED_MINUS_MODULO (_sh, _destprec); \
_sp = (srcp) + _srcs - _dests; \
\
@@ -1372,7 +1387,7 @@
if (MPFR_LIKELY (MPFR_PREC (dest) == MPFR_PREC (src))) \
{ \
MPN_COPY (MPFR_MANT (dest), MPFR_MANT (src), \
- (MPFR_PREC (src) + GMP_NUMB_BITS-1)/GMP_NUMB_BITS); \
+ MPFR_LIMB_SIZE (src)); \
inexact = 0; \
} \
else \
@@ -1682,7 +1697,7 @@
MPFR_ASSERTD (_prec >= MPFR_PREC_MIN); \
if (MPFR_UNLIKELY (_prec > MPFR_PREC_MAX)) \
mpfr_abort_prec_max (); \
- _size = (mpfr_prec_t) (_prec + GMP_NUMB_BITS - 1) / GMP_NUMB_BITS; \
+ _size = MPFR_PREC2LIMBS (_prec); \
if (MPFR_UNLIKELY (_size * (num) > MPFR_GROUP_STATIC_SIZE)) \
{ \
(g).alloc = (num) * _size * sizeof (mp_limb_t); \
@@ -1733,7 +1748,7 @@
MPFR_ASSERTD (_prec >= MPFR_PREC_MIN); \
if (MPFR_UNLIKELY (_prec > MPFR_PREC_MAX)) \
mpfr_abort_prec_max (); \
- _size = (mpfr_prec_t) (_prec + GMP_NUMB_BITS - 1) / GMP_NUMB_BITS; \
+ _size = MPFR_PREC2LIMBS (_prec); \
(g).alloc = (num) * _size * sizeof (mp_limb_t); \
if (MPFR_LIKELY (_oalloc == 0)) \
(g).mant = (mp_limb_t *) (*__gmp_allocate_func) ((g).alloc); \
@@ -1886,7 +1901,7 @@
MPFR_NORETURN_ATTR;
__MPFR_DECLSPEC void mpfr_rand_raw _MPFR_PROTO((mpfr_limb_ptr, gmp_randstate_t,
- unsigned long));
+ mpfr_prec_t));
__MPFR_DECLSPEC mpz_t* mpfr_bernoulli_internal _MPFR_PROTO((mpz_t*,
unsigned long));
diff -Naurd mpfr-3.1.0-a/src/mpfr.h mpfr-3.1.0-b/src/mpfr.h
--- mpfr-3.1.0-a/src/mpfr.h 2012-02-24 13:50:05.000000000 +0000
+++ mpfr-3.1.0-b/src/mpfr.h 2012-03-08 15:17:03.000000000 +0000
@@ -27,7 +27,7 @@
#define MPFR_VERSION_MAJOR 3
#define MPFR_VERSION_MINOR 1
#define MPFR_VERSION_PATCHLEVEL 0
-#define MPFR_VERSION_STRING "3.1.0-p6"
+#define MPFR_VERSION_STRING "3.1.0-p7"
/* Macros dealing with MPFR VERSION */
#define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
diff -Naurd mpfr-3.1.0-a/src/mul.c mpfr-3.1.0-b/src/mul.c
--- mpfr-3.1.0-a/src/mul.c 2011-10-03 08:17:09.000000000 +0000
+++ mpfr-3.1.0-b/src/mul.c 2012-03-08 15:17:03.000000000 +0000
@@ -93,15 +93,15 @@
ax = MPFR_GET_EXP (b) + MPFR_GET_EXP (c);
- bq = MPFR_PREC(b);
- cq = MPFR_PREC(c);
+ bq = MPFR_PREC (b);
+ cq = MPFR_PREC (c);
- MPFR_ASSERTD(bq+cq > bq); /* PREC_MAX is /2 so no integer overflow */
+ MPFR_ASSERTN ((mpfr_uprec_t) bq + cq <= MPFR_PREC_MAX);
- bn = (bq+GMP_NUMB_BITS-1)/GMP_NUMB_BITS; /* number of limbs of b */
- cn = (cq+GMP_NUMB_BITS-1)/GMP_NUMB_BITS; /* number of limbs of c */
+ bn = MPFR_PREC2LIMBS (bq); /* number of limbs of b */
+ cn = MPFR_PREC2LIMBS (cq); /* number of limbs of c */
k = bn + cn; /* effective nb of limbs used by b*c (= tn or tn+1) below */
- tn = (bq + cq + GMP_NUMB_BITS - 1) / GMP_NUMB_BITS;
+ tn = MPFR_PREC2LIMBS (bq + cq);
/* <= k, thus no int overflow */
MPFR_ASSERTD(tn <= k);
@@ -292,12 +292,12 @@
bq = MPFR_PREC (b);
cq = MPFR_PREC (c);
- MPFR_ASSERTD (bq+cq > bq); /* PREC_MAX is /2 so no integer overflow */
+ MPFR_ASSERTN ((mpfr_uprec_t) bq + cq <= MPFR_PREC_MAX);
- bn = (bq+GMP_NUMB_BITS-1)/GMP_NUMB_BITS; /* number of limbs of b */
- cn = (cq+GMP_NUMB_BITS-1)/GMP_NUMB_BITS; /* number of limbs of c */
+ bn = MPFR_PREC2LIMBS (bq); /* number of limbs of b */
+ cn = MPFR_PREC2LIMBS (cq); /* number of limbs of c */
k = bn + cn; /* effective nb of limbs used by b*c (= tn or tn+1) below */
- tn = (bq + cq + GMP_NUMB_BITS - 1) / GMP_NUMB_BITS;
+ tn = MPFR_PREC2LIMBS (bq + cq);
MPFR_ASSERTD (tn <= k); /* tn <= k, thus no int overflow */
/* Check for no size_t overflow*/
diff -Naurd mpfr-3.1.0-a/src/pow.c mpfr-3.1.0-b/src/pow.c
--- mpfr-3.1.0-a/src/pow.c 2011-10-03 08:17:09.000000000 +0000
+++ mpfr-3.1.0-b/src/pow.c 2012-03-08 15:17:03.000000000 +0000
@@ -136,7 +136,7 @@
(b) all the 'z' bits are zero
*/
- prec = ((prec - 1) / GMP_NUMB_BITS + 1) * GMP_NUMB_BITS - expo;
+ prec = MPFR_PREC2LIMBS (prec) * GMP_NUMB_BITS - expo;
/* number of z+0 bits */
yn = prec / GMP_NUMB_BITS;
diff -Naurd mpfr-3.1.0-a/src/print_raw.c mpfr-3.1.0-b/src/print_raw.c
--- mpfr-3.1.0-a/src/print_raw.c 2011-10-03 08:17:09.000000000 +0000
+++ mpfr-3.1.0-b/src/print_raw.c 2012-03-08 15:17:03.000000000 +0000
@@ -84,7 +84,7 @@
int i;
mpfr_prec_t count = 0;
char c;
- mp_size_t n = (r - 1) / GMP_NUMB_BITS + 1;
+ mp_size_t n = MPFR_PREC2LIMBS (r);
printf("%s ", str);
for(n-- ; n>=0 ; n--)
@@ -109,7 +109,7 @@
int i;
mpfr_prec_t count = 0;
char c;
- mp_size_t n = (r - 1) / GMP_NUMB_BITS + 1;
+ mp_size_t n = MPFR_PREC2LIMBS (r);
for(n-- ; n>=0 ; n--)
{
diff -Naurd mpfr-3.1.0-a/src/round_prec.c mpfr-3.1.0-b/src/round_prec.c
--- mpfr-3.1.0-a/src/round_prec.c 2011-10-03 08:17:09.000000000 +0000
+++ mpfr-3.1.0-b/src/round_prec.c 2012-03-08 15:17:03.000000000 +0000
@@ -55,12 +55,12 @@
MPFR_ASSERTN(prec >= MPFR_PREC_MIN && prec <= MPFR_PREC_MAX);
- nw = 1 + (prec - 1) / GMP_NUMB_BITS; /* needed allocated limbs */
+ nw = MPFR_PREC2LIMBS (prec); /* needed allocated limbs */
/* check if x has enough allocated space for the significand */
/* Get the number of limbs from the precision.
(Compatible with all allocation methods) */
- ow = (MPFR_PREC (x) + GMP_NUMB_BITS - 1) / GMP_NUMB_BITS;
+ ow = MPFR_LIMB_SIZE (x);
if (nw > ow)
{
/* FIXME: Variable can't be created using custom allocation,
diff -Naurd mpfr-3.1.0-a/src/round_raw_generic.c mpfr-3.1.0-b/src/round_raw_generic.c
--- mpfr-3.1.0-a/src/round_raw_generic.c 2011-10-03 08:17:09.000000000 +0000
+++ mpfr-3.1.0-b/src/round_raw_generic.c 2012-03-08 15:17:03.000000000 +0000
@@ -80,7 +80,7 @@
(xprec <= yprec || MPFR_IS_LIKE_RNDZ (rnd_mode, neg)))
return 0;
- xsize = (xprec-1)/GMP_NUMB_BITS + 1;
+ xsize = MPFR_PREC2LIMBS (xprec);
nw = yprec / GMP_NUMB_BITS;
rw = yprec & (GMP_NUMB_BITS - 1);
diff -Naurd mpfr-3.1.0-a/src/set.c mpfr-3.1.0-b/src/set.c
--- mpfr-3.1.0-a/src/set.c 2011-10-03 08:17:09.000000000 +0000
+++ mpfr-3.1.0-b/src/set.c 2012-03-08 15:17:03.000000000 +0000
@@ -48,8 +48,7 @@
/* Same precision and b is not singular:
* just copy the mantissa, and set the exponent and the sign
* The result is exact. */
- MPN_COPY (MPFR_MANT (a), MPFR_MANT (b),
- (MPFR_PREC (b) + GMP_NUMB_BITS-1)/GMP_NUMB_BITS);
+ MPN_COPY (MPFR_MANT (a), MPFR_MANT (b), MPFR_LIMB_SIZE (b));
MPFR_RET (0);
}
else
diff -Naurd mpfr-3.1.0-a/src/set_f.c mpfr-3.1.0-b/src/set_f.c
--- mpfr-3.1.0-a/src/set_f.c 2011-10-03 08:17:09.000000000 +0000
+++ mpfr-3.1.0-b/src/set_f.c 2012-03-08 15:17:03.000000000 +0000
@@ -43,7 +43,7 @@
if (SIZ(x) * MPFR_FROM_SIGN_TO_INT(MPFR_SIGN(y)) < 0)
MPFR_CHANGE_SIGN (y);
- sy = 1 + (MPFR_PREC(y) - 1) / GMP_NUMB_BITS;
+ sy = MPFR_LIMB_SIZE (y);
my = MPFR_MANT(y);
mx = PTR(x);
diff -Naurd mpfr-3.1.0-a/src/set_prec.c mpfr-3.1.0-b/src/set_prec.c
--- mpfr-3.1.0-a/src/set_prec.c 2011-10-03 08:17:09.000000000 +0000
+++ mpfr-3.1.0-b/src/set_prec.c 2012-03-08 15:17:03.000000000 +0000
@@ -32,7 +32,7 @@
MPFR_ASSERTN (p >= MPFR_PREC_MIN && p <= MPFR_PREC_MAX);
/* Calculate the new number of limbs */
- xsize = (p - 1) / GMP_NUMB_BITS + 1;
+ xsize = MPFR_PREC2LIMBS (p);
/* Realloc only if the new size is greater than the old */
xoldsize = MPFR_GET_ALLOC_SIZE (x);
diff -Naurd mpfr-3.1.0-a/src/setmax.c mpfr-3.1.0-b/src/setmax.c
--- mpfr-3.1.0-a/src/setmax.c 2011-10-03 08:17:09.000000000 +0000
+++ mpfr-3.1.0-b/src/setmax.c 2012-03-08 15:17:03.000000000 +0000
@@ -32,7 +32,7 @@
mp_limb_t *xp;
MPFR_SET_EXP (x, e);
- xn = 1 + (MPFR_PREC(x) - 1) / GMP_NUMB_BITS;
+ xn = MPFR_LIMB_SIZE (x);
sh = (mpfr_prec_t) xn * GMP_NUMB_BITS - MPFR_PREC(x);
xp = MPFR_MANT(x);
xp[0] = MP_LIMB_T_MAX << sh;
diff -Naurd mpfr-3.1.0-a/src/sqr.c mpfr-3.1.0-b/src/sqr.c
--- mpfr-3.1.0-a/src/sqr.c 2011-10-03 08:17:09.000000000 +0000
+++ mpfr-3.1.0-b/src/sqr.c 2012-03-08 15:17:03.000000000 +0000
@@ -56,11 +56,11 @@
ax = 2 * MPFR_GET_EXP (b);
bq = MPFR_PREC(b);
- MPFR_ASSERTD (2 * bq > bq); /* PREC_MAX is /2 so no integer overflow */
+ MPFR_ASSERTN (2 * (mpfr_uprec_t) bq <= MPFR_PREC_MAX);
- bn = MPFR_LIMB_SIZE(b); /* number of limbs of b */
- tn = 1 + (2 * bq - 1) / GMP_NUMB_BITS; /* number of limbs of square,
- 2*bn or 2*bn-1 */
+ bn = MPFR_LIMB_SIZE (b); /* number of limbs of b */
+ tn = MPFR_PREC2LIMBS (2 * bq); /* number of limbs of square,
+ 2*bn or 2*bn-1 */
if (MPFR_UNLIKELY(bn > MPFR_SQR_THRESHOLD))
return mpfr_mul (a, b, b, rnd_mode);
diff -Naurd mpfr-3.1.0-a/src/stack_interface.c mpfr-3.1.0-b/src/stack_interface.c
--- mpfr-3.1.0-a/src/stack_interface.c 2011-10-03 08:17:09.000000000 +0000
+++ mpfr-3.1.0-b/src/stack_interface.c 2012-03-08 15:17:03.000000000 +0000
@@ -26,7 +26,7 @@
size_t
mpfr_custom_get_size (mpfr_prec_t prec)
{
- return (prec + GMP_NUMB_BITS -1) / GMP_NUMB_BITS * BYTES_PER_MP_LIMB;
+ return MPFR_PREC2LIMBS (prec) * BYTES_PER_MP_LIMB;
}
#undef mpfr_custom_init
diff -Naurd mpfr-3.1.0-a/src/strtofr.c mpfr-3.1.0-b/src/strtofr.c
--- mpfr-3.1.0-a/src/strtofr.c 2011-10-03 08:17:09.000000000 +0000
+++ mpfr-3.1.0-b/src/strtofr.c 2012-03-08 15:17:03.000000000 +0000
@@ -467,7 +467,7 @@
/* Set y to the value of the ~prec most significant bits of pstr->mant
(as long as we guarantee correct rounding, we don't need to get
exactly prec bits). */
- ysize = (prec - 1) / GMP_NUMB_BITS + 1;
+ ysize = MPFR_PREC2LIMBS (prec);
/* prec bits corresponds to ysize limbs */
ysize_bits = ysize * GMP_NUMB_BITS;
/* and to ysize_bits >= prec > MPFR_PREC (x) bits */
diff -Naurd mpfr-3.1.0-a/src/sub1sp.c mpfr-3.1.0-b/src/sub1sp.c
--- mpfr-3.1.0-a/src/sub1sp.c 2011-10-03 08:17:09.000000000 +0000
+++ mpfr-3.1.0-b/src/sub1sp.c 2012-03-08 15:17:03.000000000 +0000
@@ -155,8 +155,8 @@
MPFR_ASSERTD(MPFR_IS_PURE_FP(c));
/* Read prec and num of limbs */
- p = MPFR_PREC(b);
- n = (p-1)/GMP_NUMB_BITS+1;
+ p = MPFR_PREC (b);
+ n = MPFR_PREC2LIMBS (p);
/* Fast cmp of |b| and |c|*/
bx = MPFR_GET_EXP (b);
diff -Naurd mpfr-3.1.0-a/src/urandomb.c mpfr-3.1.0-b/src/urandomb.c
--- mpfr-3.1.0-a/src/urandomb.c 2011-10-03 08:17:09.000000000 +0000
+++ mpfr-3.1.0-b/src/urandomb.c 2012-03-08 15:17:03.000000000 +0000
@@ -31,13 +31,20 @@
a sufficient number of limbs */
void
mpfr_rand_raw (mpfr_limb_ptr mp, gmp_randstate_t rstate,
- unsigned long int nbits)
+ mpfr_prec_t nbits)
{
mpz_t z;
+ MPFR_ASSERTN (nbits >= 1);
/* To be sure to avoid the potential allocation of mpz_urandomb */
- ALLOC(z) = SIZ(z) = ((nbits - 1) / GMP_NUMB_BITS) + 1;
+ ALLOC(z) = SIZ(z) = MPFR_PREC2LIMBS (nbits);
PTR(z) = mp;
+#if __MPFR_GMP(5,0,0)
+ /* Check for integer overflow (unless mp_bitcnt_t is signed,
+ but according to the GMP manual, this shouldn't happen).
+ Note: mp_bitcnt_t has been introduced in GMP 5.0.0. */
+ MPFR_ASSERTN ((mp_bitcnt_t) -1 < 0 || nbits <= (mp_bitcnt_t) -1);
+#endif
mpz_urandomb (z, rstate, nbits);
}
diff -Naurd mpfr-3.1.0-a/src/version.c mpfr-3.1.0-b/src/version.c
--- mpfr-3.1.0-a/src/version.c 2012-02-24 13:50:05.000000000 +0000
+++ mpfr-3.1.0-b/src/version.c 2012-03-08 15:17:03.000000000 +0000
@@ -25,5 +25,5 @@
const char *
mpfr_get_version (void)
{
- return "3.1.0-p6";
+ return "3.1.0-p7";
}
diff -Naurd mpfr-3.1.0-a/tests/tinits.c mpfr-3.1.0-b/tests/tinits.c
--- mpfr-3.1.0-a/tests/tinits.c 2011-10-03 08:17:14.000000000 +0000
+++ mpfr-3.1.0-b/tests/tinits.c 2012-03-08 15:17:03.000000000 +0000
@@ -1,4 +1,4 @@
-/* Test file for mpfr_inits, mpfr_inits2 and mpfr_clears.
+/* Test file for mpfr_init2, mpfr_inits, mpfr_inits2 and mpfr_clears.
Copyright 2003, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
Contributed by the Arenaire and Caramel projects, INRIA.
@@ -20,18 +20,43 @@
http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+#include <stdlib.h>
+
#include "mpfr-test.h"
int
main (void)
{
mpfr_t a, b, c;
+ long large_prec;
tests_start_mpfr ();
+
mpfr_inits (a, b, c, (mpfr_ptr) 0);
mpfr_clears (a, b, c, (mpfr_ptr) 0);
mpfr_inits2 (200, a, b, c, (mpfr_ptr) 0);
mpfr_clears (a, b, c, (mpfr_ptr) 0);
+
+ /* test for precision 2^31-1, see
+ https://gforge.inria.fr/tracker/index.php?func=detail&aid=13918 */
+ large_prec = 2147483647;
+ if (getenv ("MPFR_CHECK_LARGEMEM") != NULL)
+ {
+ /* We assume that the precision won't be increased internally. */
+ if (large_prec > MPFR_PREC_MAX)
+ large_prec = MPFR_PREC_MAX;
+ mpfr_inits2 (large_prec, a, b, (mpfr_ptr) 0);
+ mpfr_set_ui (a, 17, MPFR_RNDN);
+ mpfr_set (b, a, MPFR_RNDN);
+ if (mpfr_get_ui (a, MPFR_RNDN) != 17)
+ {
+ printf ("Error in mpfr_init2 with precision 2^31-1\n");
+ exit (1);
+ }
+ mpfr_clears (a, b, (mpfr_ptr) 0);
+ }
+
tests_end_mpfr ();
+
return 0;
}

View File

@ -1,52 +0,0 @@
diff -Naurd mpfr-3.1.0-a/PATCHES mpfr-3.1.0-b/PATCHES
--- mpfr-3.1.0-a/PATCHES 2012-03-12 11:59:47.000000000 +0000
+++ mpfr-3.1.0-b/PATCHES 2012-03-12 11:59:47.000000000 +0000
@@ -0,0 +1 @@
+__gmp_const
diff -Naurd mpfr-3.1.0-a/VERSION mpfr-3.1.0-b/VERSION
--- mpfr-3.1.0-a/VERSION 2012-03-08 15:17:03.000000000 +0000
+++ mpfr-3.1.0-b/VERSION 2012-03-12 11:59:47.000000000 +0000
@@ -1 +1 @@
-3.1.0-p7
+3.1.0-p8
diff -Naurd mpfr-3.1.0-a/src/mpfr.h mpfr-3.1.0-b/src/mpfr.h
--- mpfr-3.1.0-a/src/mpfr.h 2012-03-08 15:17:03.000000000 +0000
+++ mpfr-3.1.0-b/src/mpfr.h 2012-03-12 11:59:47.000000000 +0000
@@ -27,7 +27,7 @@
#define MPFR_VERSION_MAJOR 3
#define MPFR_VERSION_MINOR 1
#define MPFR_VERSION_PATCHLEVEL 0
-#define MPFR_VERSION_STRING "3.1.0-p7"
+#define MPFR_VERSION_STRING "3.1.0-p8"
/* Macros dealing with MPFR VERSION */
#define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
@@ -39,6 +39,18 @@
# include <gmp.h>
#endif
+/* GMP's internal __gmp_const macro has been removed on 2012-03-04:
+ http://gmplib.org:8000/gmp/rev/d287cfaf6732
+ const is standard and now assumed to be available. If the __gmp_const
+ definition is no longer present in GMP, this probably means that GMP
+ assumes that const is available; thus let's define it to const.
+ Note: this is a temporary fix that can be backported to previous MPFR
+ versions. In the future, __gmp_const should be replaced by const like
+ in GMP. */
+#ifndef __gmp_const
+# define __gmp_const const
+#endif
+
/* Avoid some problems with macro expansion if the user defines macros
with the same name as keywords. By convention, identifiers and macro
names starting with mpfr_ are reserved by MPFR. */
diff -Naurd mpfr-3.1.0-a/src/version.c mpfr-3.1.0-b/src/version.c
--- mpfr-3.1.0-a/src/version.c 2012-03-08 15:17:03.000000000 +0000
+++ mpfr-3.1.0-b/src/version.c 2012-03-12 11:59:47.000000000 +0000
@@ -25,5 +25,5 @@
const char *
mpfr_get_version (void)
{
- return "3.1.0-p7";
+ return "3.1.0-p8";
}

Some files were not shown because too many files have changed in this diff Show More