summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcoadde [Márcio Alexandre Silva Delgado] <coadde@parabola.nu>2016-04-23 18:24:06 -0300
committercoadde [Márcio Alexandre Silva Delgado] <coadde@parabola.nu>2016-04-23 18:24:06 -0300
commit3b0a078220f8746c0354aff89cc89fc2ef747f21 (patch)
tree1cf0cc955668c1432aca2ca916c32ed7f53ee9ca
parentebe216b74101dfcd898c1832758a4883bd6be24e (diff)
remove more unused packages
-rw-r--r--libre/bzip2-static/PKGBUILD46
-rw-r--r--libre/bzip2-static/bzip2-1.0.4-bzip2recover.patch12
-rw-r--r--libre/gcc-libs-static/PKGBUILD132
-rw-r--r--libre/gcc-libs-static/Unlink-the-response-file.patch54
-rw-r--r--libre/gmp-static/PKGBUILD41
-rw-r--r--libre/libffi-static/0001-Fix-paths-in-libffi.pc.in.patch41
-rw-r--r--libre/libffi-static/PKGBUILD36
-rw-r--r--libre/libmpc-static/PKGBUILD37
-rw-r--r--libre/libssh2-static/PKGBUILD35
-rw-r--r--libre/mpfr-static/PKGBUILD46
-rw-r--r--libre/mpfr-static/mpfr-3.1.2-p11.patch1626
-rw-r--r--libre/mpfr-static/mpfr-3.1.3-p5.patch1830
-rw-r--r--libre/ncurses-static/PKGBUILD44
-rw-r--r--libre/nspr-static/PKGBUILD43
-rw-r--r--libre/readline-static/PKGBUILD71
15 files changed, 0 insertions, 4094 deletions
diff --git a/libre/bzip2-static/PKGBUILD b/libre/bzip2-static/PKGBUILD
deleted file mode 100644
index 36d888398..000000000
--- a/libre/bzip2-static/PKGBUILD
+++ /dev/null
@@ -1,46 +0,0 @@
-# Maintainer: Márcio Silva <coadde@parabola.nu>
-# based of bzip2
-
-_pkgname=bzip2
-pkgname=bzip2-static
-pkgver=1.0.6
-pkgrel=5.1
-pkgdesc="A high-quality data compression program (static libraries only)"
-arch=('i686' 'x86_64' 'armv7h')
-license=('custom')
-url="http://sources.redhat.com/bzip2"
-depends=('bzip2')
-options=('staticlibs')
-source=(http://www.bzip.org/$pkgver/bzip2-$pkgver.tar.gz
- bzip2-1.0.4-bzip2recover.patch)
-sha1sums=('3f89f861209ce81a6bab1fd1998c0ef311712002'
- '85ce76fdb67f52f152bba368c1de81132dcdbdb5')
-
-build() {
- cd "$srcdir/$_pkgname-$pkgver"
-
- # add large-file support
- sed -e 's/^CFLAGS=\(.*\)$/CFLAGS=\1 \$(BIGFILES)/' -i ./Makefile-libbz2_so
-
- # use our optimization
- sed -i "s|-O2|${CFLAGS}|g" Makefile
- sed -i "s|-O2|${CFLAGS}|g" Makefile-libbz2_so
-
- patch -Np1 < ../bzip2-1.0.4-bzip2recover.patch
-
- make -f Makefile-libbz2_so
- make bzip2 bzip2recover
-}
-
-check() {
- cd "$srcdir/$_pkgname-$pkgver"
- make test
-}
-
-package() {
- cd "$srcdir/$_pkgname-$pkgver"
-
- install -dm755 $pkgdir/usr/lib
-
- install -m755 libbz2.a $pkgdir/usr/lib
-}
diff --git a/libre/bzip2-static/bzip2-1.0.4-bzip2recover.patch b/libre/bzip2-static/bzip2-1.0.4-bzip2recover.patch
deleted file mode 100644
index e2bfe1cc1..000000000
--- a/libre/bzip2-static/bzip2-1.0.4-bzip2recover.patch
+++ /dev/null
@@ -1,12 +0,0 @@
---- bzip2-1.0.4/bzip2recover.c.pom 2007-01-03 03:00:55.000000000 +0100
-+++ bzip2-1.0.4/bzip2recover.c 2007-02-05 11:55:17.000000000 +0100
-@@ -309,7 +309,8 @@
- UInt32 buffHi, buffLo, blockCRC;
- Char* p;
-
-- strcpy ( progName, argv[0] );
-+ strncpy ( progName, argv[0], BZ_MAX_FILENAME-1);
-+ progName[BZ_MAX_FILENAME-1]='\0';
- inFileName[0] = outFileName[0] = 0;
-
- fprintf ( stderr,
diff --git a/libre/gcc-libs-static/PKGBUILD b/libre/gcc-libs-static/PKGBUILD
deleted file mode 100644
index 396b19375..000000000
--- a/libre/gcc-libs-static/PKGBUILD
+++ /dev/null
@@ -1,132 +0,0 @@
-# Maintainer: Márcio Silva <coadde@parabola.nu>
-# based of gcc
-
-_pkgname=gcc-libs
-pkgname=gcc-libs-static
-pkgver=5.3.0
-_pkgver=5
-_islver=0.15
-pkgrel=5
-_snapshot=5-20160209
-pkgdesc="The GNU Compiler Collection (static libraries only)"
-arch=('i686' 'x86_64' 'armv7h')
-license=('GPL' 'LGPL' 'FDL' 'custom')
-url="http://gcc.gnu.org"
-makedepends=('binutils>=2.26' 'libmpc-static' 'gcc-ada')
-checkdepends=('dejagnu' 'inetutils')
-options=('!docs' 'staticlibs' '!emptydirs')
-source=(#ftp://gcc.gnu.org/pub/gcc/releases/gcc-${pkgver}/gcc-${pkgver}.tar.bz2
- ftp://gcc.gnu.org/pub/gcc/snapshots/${_snapshot}/gcc-${_snapshot}.tar.bz2
- http://isl.gforge.inria.fr/isl-${_islver}.tar.bz2
- Unlink-the-response-file.patch)
-md5sums=('499161c65b639aa5c12a14944582b7ec'
- '8428efbbc6f6e2810ce5c1ba73ecf98c'
- '1f4d4ef71004261376d26d5ba6a84499')
-
-if [ -n "${_snapshot}" ]; then
- _basedir=gcc-${_snapshot}
-else
- _basedir=gcc-${pkgver}
-fi
-
-_libdir="usr/lib/gcc/$CHOST/$pkgver"
-
-prepare() {
- cd ${srcdir}/${_basedir}
-
- # link isl for in-tree build
- ln -s ../isl-${_islver} isl
-
- # Do not run fixincludes
- sed -i 's@\./fixinc\.sh@-c true@' gcc/Makefile.in
-
- # Parabola GNU/Linux-libre installs x86_64 libraries /lib
- [[ $CARCH == "x86_64" ]] && sed -i '/m64=/s/lib64/lib/' gcc/config/i386/t-linux64
-
- echo ${pkgver} > gcc/BASE-VER
-
- # hack! - some configure tests for header files using "$CPP $CPPFLAGS"
- sed -i "/ac_cpp=/s/\$CPPFLAGS/\$CPPFLAGS -O2/" {libiberty,gcc}/configure
-
- # https://bugs.archlinux.org/task/47874 - commit f591a95d
- patch -p1 -i $srcdir/Unlink-the-response-file.patch
-
- mkdir ${srcdir}/gcc-build
-}
-
-build() {
- cd ${srcdir}/gcc-build
-
- # using -pipe causes spurious test-suite failures
- # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48565
- # enable -fPIC for static libraries
- CFLAGS="${CFLAGS/-pipe/} -fPIC"
- CXXFLAGS="${CXXFLAGS/-pipe/} -fPIC"
-
- ${srcdir}/${_basedir}/configure --prefix=/usr \
- --libdir=/usr/lib \
- --with-bugurl=https://labs.parabola.nu/ \
- --enable-languages=c,c++,ada,fortran,lto,objc,obj-c++ \
- --disable-shared --enable-threads=posix --enable-libmpx \
- --with-system-zlib --with-isl --enable-__cxa_atexit \
- --disable-libunwind-exceptions --enable-clocale=gnu \
- --disable-libstdcxx-pch --disable-libssp \
- --enable-gnu-unique-object --enable-linker-build-id \
- --enable-lto --enable-plugin --enable-install-libiberty \
- --with-linker-hash-style=gnu --enable-gnu-indirect-function \
- --disable-multilib --disable-werror \
- --enable-checking=release
-
- make
-
- # --enble-languages=go
-
-}
-
-check() {
- cd ${srcdir}/gcc-build
-
- # increase stack size to prevent test failures
- # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31827
- ulimit -s 32768
-
- # do not abort on error as some are "expected"
- make -k check || true
- ${srcdir}/${_basedir}/contrib/test_summary
-}
-
-package()
-{
- pkgdesc="Runtime libraries shipped by GCC (static libraries only)"
- depends=('gcc-libs')
- options=('!emptydirs' '!strip' '!docs' 'staticlibs')
-
- cd ${srcdir}/gcc-build
-
- make -C $CHOST/libgcc DESTDIR=${pkgdir} install
-
- for lib in libatomic \
- libcilkrts \
- libgfortran \
- libgomp \
- libitm \
- libquadmath \
- libsanitizer/{a,l,ub}san \
- libstdc++-v3/src \
- libvtv; do
- make -C $CHOST/$lib DESTDIR=${pkgdir} install-toolexeclibLTLIBRARIES
- done
- # libgo
-
- [[ $CARCH == "x86_64" ]] && \
- make -C $CHOST/libsanitizer/tsan DESTDIR=${pkgdir} install-toolexeclibLTLIBRARIES
-
- make -C $CHOST/libobjc DESTDIR=${pkgdir} install
-
- make -C $CHOST/libmpx DESTDIR=${pkgdir} install
- rm -v ${pkgdir}/usr/lib/libmpx.spec
-
- # remove conflicting files
- rm -vr ${pkgdir}/usr/lib/gcc
- rm -v ${pkgdir}/usr/lib/libstdc++.a
-}
diff --git a/libre/gcc-libs-static/Unlink-the-response-file.patch b/libre/gcc-libs-static/Unlink-the-response-file.patch
deleted file mode 100644
index 55c95a797..000000000
--- a/libre/gcc-libs-static/Unlink-the-response-file.patch
+++ /dev/null
@@ -1,54 +0,0 @@
-From f591a95d1532ac7791c146a8e55ba3a32b3e476f Mon Sep 17 00:00:00 2001
-From: ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>
-Date: Tue, 23 Jun 2015 20:48:07 +0000
-Subject: [PATCH] * collect-utils.c (collect_wait): Unlink the
- response file here instead of... (do_wait): ...here.
- (utils_cleanup): ...and here.
-
-git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@224858 138bc75d-0d04-0410-961f-82ee72b054a4
----
- gcc/ChangeLog | 7 +++++++
- gcc/collect-utils.c | 14 ++++++--------
- 2 files changed, 13 insertions(+), 8 deletions(-)
-
-diff --git a/gcc/collect-utils.c b/gcc/collect-utils.c
-index 6bbe9eb..517a075 100644
---- a/gcc/collect-utils.c
-+++ b/gcc/collect-utils.c
-@@ -68,6 +68,12 @@ collect_wait (const char *prog, struct pex_obj *pex)
- fatal_error (input_location, "can't get program status: %m");
- pex_free (pex);
-
-+ if (response_file && !save_temps)
-+ {
-+ unlink (response_file);
-+ response_file = NULL;
-+ }
-+
- if (status)
- {
- if (WIFSIGNALED (status))
-@@ -90,12 +96,6 @@ do_wait (const char *prog, struct pex_obj *pex)
- int ret = collect_wait (prog, pex);
- if (ret != 0)
- fatal_error (input_location, "%s returned %d exit status", prog, ret);
--
-- if (response_file && !save_temps)
-- {
-- unlink (response_file);
-- response_file = NULL;
-- }
- }
-
-
-@@ -224,7 +224,5 @@ utils_cleanup (bool from_signal)
- calls to maybe_unlink fails. */
- cleanup_done = true;
-
-- if (response_file)
-- maybe_unlink (response_file);
- tool_cleanup (from_signal);
- }
---
-2.7.1
-
diff --git a/libre/gmp-static/PKGBUILD b/libre/gmp-static/PKGBUILD
deleted file mode 100644
index 83fa8087d..000000000
--- a/libre/gmp-static/PKGBUILD
+++ /dev/null
@@ -1,41 +0,0 @@
-# Maintainer: Márcio Silva <coadde@parabola.nu>
-# based of gmp
-
-_pkgname=gmp
-pkgname=gmp-static
-pkgver=6.1.0
-pkgrel=3
-pkgdesc="A free library for arbitrary precision arithmetic (static libraries only)"
-arch=('i686' 'x86_64' 'armv7h')
-url="http://gmplib.org/"
-depends=('gcc-libs-static' 'gmp')
-license=('LGPL3' 'GPL')
-options=('staticlibs')
-source=(https://gmplib.org/download/gmp/gmp-${pkgver}.tar.xz{,.sig})
-md5sums=('a9868ef2556ad6a2909babcd1428f3c7'
- 'SKIP')
-validpgpkeys=('5972C48224C1E7E62AA0275D1150EE33C1A000B0') # Marco Bodrato
-
-build() {
- cd "${srcdir}/${_pkgname}-${pkgver}"
-
- ./configure --build=${CHOST} \
- --prefix=/usr \
- --enable-cxx
- # do not --enable-fat - see https://bugs.archlinux.org/task/47284
- make
-}
-
-check() {
- cd "${srcdir}/${_pkgname}-${pkgver}"
- make check
-}
-
-package() {
- cd "${srcdir}/${_pkgname}-${pkgver}"
- make DESTDIR="${pkgdir}" install
-
- # remove conflicting files
- rm -vr ${pkgdir}/usr/{include,share}
- rm -v ${pkgdir}/usr/lib/libgmp*.so*
-}
diff --git a/libre/libffi-static/0001-Fix-paths-in-libffi.pc.in.patch b/libre/libffi-static/0001-Fix-paths-in-libffi.pc.in.patch
deleted file mode 100644
index a4860a400..000000000
--- a/libre/libffi-static/0001-Fix-paths-in-libffi.pc.in.patch
+++ /dev/null
@@ -1,41 +0,0 @@
-From ad0d1d239afc7ad09203847793dcc020856d1035 Mon Sep 17 00:00:00 2001
-From: Samuli Suominen <ssuominen@gentoo.org>
-Date: Thu, 12 Jun 2014 06:30:21 -0400
-Subject: [PATCH] Fix paths in libffi.pc.in
-
----
- configure.ac | 10 +++++-----
- 1 file changed, 5 insertions(+), 5 deletions(-)
-
-diff --git a/configure.ac b/configure.ac
-index 4f7fe3f..bbc1a9d 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -590,11 +590,11 @@ AC_ARG_ENABLE(purify-safety,
- if test "x$GCC" = "xyes"; then
- if test -n "$with_cross_host" &&
- test x"$with_cross_host" != x"no"; then
-- toolexecdir='$(exec_prefix)/$(target_alias)'
-- toolexeclibdir='$(toolexecdir)/lib'
-+ toolexecdir="${exec_prefix}"/'$(target_alias)'
-+ toolexeclibdir="${toolexecdir}"/lib
- else
-- toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
-- toolexeclibdir='$(libdir)'
-+ toolexecdir="${libdir}"/gcc-lib/'$(target_alias)'
-+ toolexeclibdir="${libdir}"
- fi
- multi_os_directory=`$CC $CFLAGS -print-multi-os-directory`
- case $multi_os_directory in
-@@ -603,7 +603,7 @@ if test "x$GCC" = "xyes"; then
- esac
- AC_SUBST(toolexecdir)
- else
-- toolexeclibdir='$(libdir)'
-+ toolexeclibdir="${libdir}"
- fi
- AC_SUBST(toolexeclibdir)
-
---
-2.0.0
-
diff --git a/libre/libffi-static/PKGBUILD b/libre/libffi-static/PKGBUILD
deleted file mode 100644
index 4badbc994..000000000
--- a/libre/libffi-static/PKGBUILD
+++ /dev/null
@@ -1,36 +0,0 @@
-# Maintainer: Márcio Silva <coadde@parabola.nu>
-# based of libffi
-
-_pkgname=libffi
-pkgname=libffi-static
-pkgver=3.2.1
-pkgrel=1
-pkgdesc='Portable foreign function interface library (static libraries only)'
-arch=('i686' 'x86_64' 'armv7h')
-url='http://sourceware.org/libffi/'
-license=('MIT')
-depends=('libffi')
-checkdepends=('dejagnu')
-options=('staticlibs')
-source=(ftp://sourceware.org/pub/libffi/libffi-$pkgver.tar.gz)
-sha1sums=('280c265b789e041c02e5c97815793dfc283fb1e6')
-
-build() {
- cd $_pkgname-$pkgver
- ./configure --prefix=/usr --enable-static \
- --enable-pax_emutramp
- make
-}
-
-check() {
- make -C $_pkgname-$pkgver check
-}
-
-package() {
- cd $_pkgname-$pkgver
- make DESTDIR="$pkgdir" install
-
- # remove conflicting files
- rm -vr ${pkgdir}/usr/{lib/{libffi-${pkgver},pkgconfig},share}
- rm -v ${pkgdir}/usr/lib/libffi.so*
-}
diff --git a/libre/libmpc-static/PKGBUILD b/libre/libmpc-static/PKGBUILD
deleted file mode 100644
index fd1591648..000000000
--- a/libre/libmpc-static/PKGBUILD
+++ /dev/null
@@ -1,37 +0,0 @@
-# Maintainer: Márcio Silva <coadde@parabola.nu>
-# based of libmpc
-
-_pkgname=libmpc
-pkgname=libmpc-static
-pkgver=1.0.3
-pkgrel=1
-pkgdesc="Library for the arithmetic of complex numbers with arbitrarily high precision (static libraries only)"
-arch=('i686' 'x86_64' 'armv7h')
-url="http://www.multiprecision.org/"
-license=('LGPL')
-depends=('mpfr-static' 'libmpc')
-options=('staticlibs')
-source=(http://www.multiprecision.org/mpc/download/mpc-${pkgver/_/-}.tar.gz{,.sig})
-md5sums=('d6a1d5f8ddea3abd2cc3e98f58352d26'
- 'SKIP')
-validpgpkeys=('AD17A21EF8AED8F1CC02DBD9F7D5C9BF765C61E3') # Andreas Enge
-
-build() {
- cd "${srcdir}/mpc-${pkgver}"
- ./configure --prefix=/usr
- make
-}
-
-check() {
- cd "${srcdir}/mpc-${pkgver}"
- make check
-}
-
-package() {
- cd "${srcdir}/mpc-${pkgver}"
- make DESTDIR="${pkgdir}" install
-
- # remove conflicting files
- rm -vr ${pkgdir}/usr/{include,share}
- rm -v ${pkgdir}/usr/lib/libmpc.so*
-}
diff --git a/libre/libssh2-static/PKGBUILD b/libre/libssh2-static/PKGBUILD
deleted file mode 100644
index f3827fcbb..000000000
--- a/libre/libssh2-static/PKGBUILD
+++ /dev/null
@@ -1,35 +0,0 @@
-# Maintainer: Márcio Silva <coadde@parabola.nu>
-# based of libssh2
-
-_pkgname=libssh2
-pkgname=libssh2-static
-pkgver=1.7.0
-pkgrel=2
-pkgdesc="A library implementing the SSH2 protocol as defined by Internet Drafts (static libraries only)"
-url="http://www.libssh2.org/"
-arch=('i686' 'x86_64' 'armv7h')
-license=('BSD')
-depends=('openssl-static' 'libssh2')
-makedepends=('zlib')
-options=('staticlibs')
-validpgpkeys=('914C533DF9B2ADA2204F586D78E11C6B279D5C91') # Daniel Stenberg
-source=("http://www.libssh2.org/download/$_pkgname-$pkgver.tar.gz"{,.asc})
-md5sums=('b01662a210e94cccf2f76094db7dac5c'
- 'SKIP')
-
-build() {
- cd "$_pkgname-$pkgver"
-
- ./configure --prefix=/usr
- make
-}
-
-package() {
- cd "$_pkgname-$pkgver"
-
- make DESTDIR="$pkgdir" install
-
- # remove conflicting files
- rm -vr ${pkgdir}/usr/{include,lib/pkgconfig,share}
- rm -v ${pkgdir}/usr/lib/lib*.so*
-}
diff --git a/libre/mpfr-static/PKGBUILD b/libre/mpfr-static/PKGBUILD
deleted file mode 100644
index 5be93051b..000000000
--- a/libre/mpfr-static/PKGBUILD
+++ /dev/null
@@ -1,46 +0,0 @@
-# Maintainer: Márcio Silva <coadde@parabola.nu>
-# based of mpfr
-
-_pkgname=mpfr
-pkgname=mpfr-static
-_pkgver=3.1.4
-#_patchlevel=p5
-#pkgver=${_pkgver}.${_patchlevel}
-pkgver=${_pkgver}
-pkgrel=1
-pkgdesc="Multiple-precision floating-point library (static libraries only)"
-arch=('i686' 'x86_64')
-url="http://www.mpfr.org/"
-license=('LGPL')
-depends=('gmp-static>=5.0' 'mpfr')
-options=('staticlibs')
-source=(http://www.mpfr.org/mpfr-current/mpfr-${_pkgver}.tar.xz{,.asc})
-# mpfr-${_pkgver}-${_patchlevel}.patch)
-md5sums=('064b2c18185038e404a401b830d59be8'
- 'SKIP')
-validpgpkeys=('07F3DBBECC1A39605078094D980C197698C3739D')
-
-#prepare() {
-# cd "${srcdir}/${pkgname}-${_pkgver}"
-# patch -p1 -i $srcdir/mpfr-${_pkgver}-${_patchlevel}.patch
-#}
-
-build() {
- cd "${srcdir}/${_pkgname}-${_pkgver}"
- ./configure --prefix=/usr --enable-thread-safe --enable-shared
- make
-}
-
-check() {
- cd "${srcdir}/${_pkgname}-${_pkgver}"
- make check
-}
-
-package() {
- cd "${srcdir}/${_pkgname}-${_pkgver}"
- make DESTDIR="${pkgdir}" install
-
- # remove conflicting files
- rm -vr ${pkgdir}/usr/{include,share}
- rm -v ${pkgdir}/usr/lib/libmpfr.so*
-}
diff --git a/libre/mpfr-static/mpfr-3.1.2-p11.patch b/libre/mpfr-static/mpfr-3.1.2-p11.patch
deleted file mode 100644
index cbfe0f533..000000000
--- a/libre/mpfr-static/mpfr-3.1.2-p11.patch
+++ /dev/null
@@ -1,1626 +0,0 @@
-diff -Naurd mpfr-3.1.2-a/PATCHES mpfr-3.1.2-b/PATCHES
---- mpfr-3.1.2-a/PATCHES 2013-09-26 10:52:52.000000000 +0000
-+++ mpfr-3.1.2-b/PATCHES 2013-09-26 10:52:52.000000000 +0000
-@@ -0,0 +1 @@
-+exp_2
-diff -Naurd mpfr-3.1.2-a/VERSION mpfr-3.1.2-b/VERSION
---- mpfr-3.1.2-a/VERSION 2013-03-13 15:37:28.000000000 +0000
-+++ mpfr-3.1.2-b/VERSION 2013-09-26 10:52:52.000000000 +0000
-@@ -1 +1 @@
--3.1.2
-+3.1.2-p1
-diff -Naurd mpfr-3.1.2-a/src/exp_2.c mpfr-3.1.2-b/src/exp_2.c
---- mpfr-3.1.2-a/src/exp_2.c 2013-03-13 15:37:28.000000000 +0000
-+++ mpfr-3.1.2-b/src/exp_2.c 2013-09-26 10:52:52.000000000 +0000
-@@ -204,7 +204,7 @@
- for (k = 0; k < K; k++)
- {
- mpz_mul (ss, ss, ss);
-- exps <<= 1;
-+ exps *= 2;
- exps += mpz_normalize (ss, ss, q);
- }
- mpfr_set_z (s, ss, MPFR_RNDN);
-diff -Naurd mpfr-3.1.2-a/src/mpfr.h mpfr-3.1.2-b/src/mpfr.h
---- mpfr-3.1.2-a/src/mpfr.h 2013-03-13 15:37:37.000000000 +0000
-+++ mpfr-3.1.2-b/src/mpfr.h 2013-09-26 10:52:52.000000000 +0000
-@@ -27,7 +27,7 @@
- #define MPFR_VERSION_MAJOR 3
- #define MPFR_VERSION_MINOR 1
- #define MPFR_VERSION_PATCHLEVEL 2
--#define MPFR_VERSION_STRING "3.1.2"
-+#define MPFR_VERSION_STRING "3.1.2-p1"
-
- /* Macros dealing with MPFR VERSION */
- #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
-diff -Naurd mpfr-3.1.2-a/src/version.c mpfr-3.1.2-b/src/version.c
---- mpfr-3.1.2-a/src/version.c 2013-03-13 15:37:34.000000000 +0000
-+++ mpfr-3.1.2-b/src/version.c 2013-09-26 10:52:52.000000000 +0000
-@@ -25,5 +25,5 @@
- const char *
- mpfr_get_version (void)
- {
-- return "3.1.2";
-+ return "3.1.2-p1";
- }
-diff -Naurd mpfr-3.1.2-a/PATCHES mpfr-3.1.2-b/PATCHES
---- mpfr-3.1.2-a/PATCHES 2013-09-26 10:56:55.000000000 +0000
-+++ mpfr-3.1.2-b/PATCHES 2013-09-26 10:56:55.000000000 +0000
-@@ -0,0 +1 @@
-+fits-smallneg
-diff -Naurd mpfr-3.1.2-a/VERSION mpfr-3.1.2-b/VERSION
---- mpfr-3.1.2-a/VERSION 2013-09-26 10:52:52.000000000 +0000
-+++ mpfr-3.1.2-b/VERSION 2013-09-26 10:56:55.000000000 +0000
-@@ -1 +1 @@
--3.1.2-p1
-+3.1.2-p2
-diff -Naurd mpfr-3.1.2-a/src/fits_u.h mpfr-3.1.2-b/src/fits_u.h
---- mpfr-3.1.2-a/src/fits_u.h 2013-03-13 15:37:35.000000000 +0000
-+++ mpfr-3.1.2-b/src/fits_u.h 2013-09-26 10:56:55.000000000 +0000
-@@ -32,17 +32,20 @@
- int res;
-
- if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (f)))
-- /* Zero always fit */
-- return MPFR_IS_ZERO (f) ? 1 : 0;
-- else if (MPFR_IS_NEG (f))
-- /* Negative numbers don't fit */
-- return 0;
-- /* now it fits if
-- (a) f <= MAXIMUM
-- (b) round(f, prec(slong), rnd) <= MAXIMUM */
-+ return MPFR_IS_ZERO (f) ? 1 : 0; /* Zero always fits */
-
- e = MPFR_GET_EXP (f);
-
-+ if (MPFR_IS_NEG (f))
-+ return e >= 1 ? 0 /* f <= -1 does not fit */
-+ : rnd != MPFR_RNDN ? MPFR_IS_LIKE_RNDU (rnd, -1) /* directed mode */
-+ : e < 0 ? 1 /* f > -1/2 fits in MPFR_RNDN */
-+ : mpfr_powerof2_raw(f); /* -1/2 fits, -1 < f < -1/2 don't */
-+
-+ /* Now it fits if
-+ (a) f <= MAXIMUM
-+ (b) round(f, prec(slong), rnd) <= MAXIMUM */
-+
- /* first compute prec(MAXIMUM); fits in an int */
- for (s = MAXIMUM, prec = 0; s != 0; s /= 2, prec ++);
-
-diff -Naurd mpfr-3.1.2-a/src/fits_uintmax.c mpfr-3.1.2-b/src/fits_uintmax.c
---- mpfr-3.1.2-a/src/fits_uintmax.c 2013-03-13 15:37:33.000000000 +0000
-+++ mpfr-3.1.2-b/src/fits_uintmax.c 2013-09-26 10:56:55.000000000 +0000
-@@ -27,51 +27,19 @@
- #include "mpfr-intmax.h"
- #include "mpfr-impl.h"
-
--#ifdef _MPFR_H_HAVE_INTMAX_T
--
--/* We can't use fits_u.h <= mpfr_cmp_ui */
--int
--mpfr_fits_uintmax_p (mpfr_srcptr f, mpfr_rnd_t rnd)
--{
-- mpfr_exp_t e;
-- int prec;
-- uintmax_t s;
-- mpfr_t x;
-- int res;
--
-- if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (f)))
-- /* Zero always fit */
-- return MPFR_IS_ZERO (f) ? 1 : 0;
-- else if (MPFR_IS_NEG (f))
-- /* Negative numbers don't fit */
-- return 0;
-- /* now it fits if
-- (a) f <= MAXIMUM
-- (b) round(f, prec(slong), rnd) <= MAXIMUM */
--
-- e = MPFR_GET_EXP (f);
--
-- /* first compute prec(MAXIMUM); fits in an int */
-- for (s = MPFR_UINTMAX_MAX, prec = 0; s != 0; s /= 2, prec ++);
--
-- /* MAXIMUM needs prec bits, i.e. MAXIMUM = 2^prec - 1 */
--
-- /* if e <= prec - 1, then f < 2^(prec-1) < MAXIMUM */
-- if (e <= prec - 1)
-- return 1;
-+/* Note: though mpfr-impl.h is included in fits_u.h, we also include it
-+ above so that it gets included even when _MPFR_H_HAVE_INTMAX_T is not
-+ defined; this is necessary to avoid an empty translation unit, which
-+ is forbidden by ISO C. Without this, a failing test can be reproduced
-+ by creating an invalid stdint.h somewhere in the default include path
-+ and by compiling MPFR with "gcc -ansi -pedantic-errors". */
-
-- /* if e >= prec + 1, then f >= 2^prec > MAXIMUM */
-- if (e >= prec + 1)
-- return 0;
-+#ifdef _MPFR_H_HAVE_INTMAX_T
-
-- MPFR_ASSERTD (e == prec);
-+#define FUNCTION mpfr_fits_uintmax_p
-+#define MAXIMUM MPFR_UINTMAX_MAX
-+#define TYPE uintmax_t
-
-- /* hard case: first round to prec bits, then check */
-- mpfr_init2 (x, prec);
-- mpfr_set (x, f, rnd);
-- res = MPFR_GET_EXP (x) == e;
-- mpfr_clear (x);
-- return res;
--}
-+#include "fits_u.h"
-
- #endif
-diff -Naurd mpfr-3.1.2-a/src/mpfr.h mpfr-3.1.2-b/src/mpfr.h
---- mpfr-3.1.2-a/src/mpfr.h 2013-09-26 10:52:52.000000000 +0000
-+++ mpfr-3.1.2-b/src/mpfr.h 2013-09-26 10:56:55.000000000 +0000
-@@ -27,7 +27,7 @@
- #define MPFR_VERSION_MAJOR 3
- #define MPFR_VERSION_MINOR 1
- #define MPFR_VERSION_PATCHLEVEL 2
--#define MPFR_VERSION_STRING "3.1.2-p1"
-+#define MPFR_VERSION_STRING "3.1.2-p2"
-
- /* Macros dealing with MPFR VERSION */
- #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
-diff -Naurd mpfr-3.1.2-a/src/version.c mpfr-3.1.2-b/src/version.c
---- mpfr-3.1.2-a/src/version.c 2013-09-26 10:52:52.000000000 +0000
-+++ mpfr-3.1.2-b/src/version.c 2013-09-26 10:56:55.000000000 +0000
-@@ -25,5 +25,5 @@
- const char *
- mpfr_get_version (void)
- {
-- return "3.1.2-p1";
-+ return "3.1.2-p2";
- }
-diff -Naurd mpfr-3.1.2-a/tests/tfits.c mpfr-3.1.2-b/tests/tfits.c
---- mpfr-3.1.2-a/tests/tfits.c 2013-03-13 15:37:45.000000000 +0000
-+++ mpfr-3.1.2-b/tests/tfits.c 2013-09-26 10:56:55.000000000 +0000
-@@ -33,155 +33,176 @@
- #include "mpfr-intmax.h"
- #include "mpfr-test.h"
-
--#define ERROR1 { printf("Initial error for x="); mpfr_dump(x); exit(1); }
--#define ERROR2 { printf("Error for x="); mpfr_dump(x); exit(1); }
-+#define ERROR1(N) \
-+ do \
-+ { \
-+ printf("Error %d for rnd = %s and x = ", N, \
-+ mpfr_print_rnd_mode ((mpfr_rnd_t) r)); \
-+ mpfr_dump(x); \
-+ exit(1); \
-+ } \
-+ while (0)
-
- static void check_intmax (void);
-
- int
- main (void)
- {
-- mpfr_t x;
-+ mpfr_t x, y;
-+ int i, r;
-
- tests_start_mpfr ();
-
- mpfr_init2 (x, 256);
-+ mpfr_init2 (y, 8);
-
-- /* Check NAN */
-- mpfr_set_nan (x);
-- if (mpfr_fits_ulong_p (x, MPFR_RNDN))
-- ERROR1;
-- if (mpfr_fits_slong_p (x, MPFR_RNDN))
-- ERROR1;
-- if (mpfr_fits_uint_p (x, MPFR_RNDN))
-- ERROR1;
-- if (mpfr_fits_sint_p (x, MPFR_RNDN))
-- ERROR1;
-- if (mpfr_fits_ushort_p (x, MPFR_RNDN))
-- ERROR1;
-- if (mpfr_fits_sshort_p (x, MPFR_RNDN))
-- ERROR1;
-+ RND_LOOP (r)
-+ {
-
-- /* Check INF */
-- mpfr_set_inf (x, 1);
-- if (mpfr_fits_ulong_p (x, MPFR_RNDN))
-- ERROR1;
-- if (mpfr_fits_slong_p (x, MPFR_RNDN))
-- ERROR1;
-- if (mpfr_fits_uint_p (x, MPFR_RNDN))
-- ERROR1;
-- if (mpfr_fits_sint_p (x, MPFR_RNDN))
-- ERROR1;
-- if (mpfr_fits_ushort_p (x, MPFR_RNDN))
-- ERROR1;
-- if (mpfr_fits_sshort_p (x, MPFR_RNDN))
-- ERROR1;
-+ /* Check NAN */
-+ mpfr_set_nan (x);
-+ if (mpfr_fits_ulong_p (x, (mpfr_rnd_t) r))
-+ ERROR1 (1);
-+ if (mpfr_fits_slong_p (x, (mpfr_rnd_t) r))
-+ ERROR1 (2);
-+ if (mpfr_fits_uint_p (x, (mpfr_rnd_t) r))
-+ ERROR1 (3);
-+ if (mpfr_fits_sint_p (x, (mpfr_rnd_t) r))
-+ ERROR1 (4);
-+ if (mpfr_fits_ushort_p (x, (mpfr_rnd_t) r))
-+ ERROR1 (5);
-+ if (mpfr_fits_sshort_p (x, (mpfr_rnd_t) r))
-+ ERROR1 (6);
-
-- /* Check Zero */
-- MPFR_SET_ZERO (x);
-- if (!mpfr_fits_ulong_p (x, MPFR_RNDN))
-- ERROR2;
-- if (!mpfr_fits_slong_p (x, MPFR_RNDN))
-- ERROR2;
-- if (!mpfr_fits_uint_p (x, MPFR_RNDN))
-- ERROR2;
-- if (!mpfr_fits_sint_p (x, MPFR_RNDN))
-- ERROR2;
-- if (!mpfr_fits_ushort_p (x, MPFR_RNDN))
-- ERROR2;
-- if (!mpfr_fits_sshort_p (x, MPFR_RNDN))
-- ERROR2;
-+ /* Check INF */
-+ mpfr_set_inf (x, 1);
-+ if (mpfr_fits_ulong_p (x, (mpfr_rnd_t) r))
-+ ERROR1 (7);
-+ if (mpfr_fits_slong_p (x, (mpfr_rnd_t) r))
-+ ERROR1 (8);
-+ if (mpfr_fits_uint_p (x, (mpfr_rnd_t) r))
-+ ERROR1 (9);
-+ if (mpfr_fits_sint_p (x, (mpfr_rnd_t) r))
-+ ERROR1 (10);
-+ if (mpfr_fits_ushort_p (x, (mpfr_rnd_t) r))
-+ ERROR1 (11);
-+ if (mpfr_fits_sshort_p (x, (mpfr_rnd_t) r))
-+ ERROR1 (12);
-
-- /* Check small op */
-- mpfr_set_str1 (x, "1@-1");
-- if (!mpfr_fits_ulong_p (x, MPFR_RNDN))
-- ERROR2;
-- if (!mpfr_fits_slong_p (x, MPFR_RNDN))
-- ERROR2;
-- if (!mpfr_fits_uint_p (x, MPFR_RNDN))
-- ERROR2;
-- if (!mpfr_fits_sint_p (x, MPFR_RNDN))
-- ERROR2;
-- if (!mpfr_fits_ushort_p (x, MPFR_RNDN))
-- ERROR2;
-- if (!mpfr_fits_sshort_p (x, MPFR_RNDN))
-- ERROR2;
-+ /* Check Zero */
-+ MPFR_SET_ZERO (x);
-+ if (!mpfr_fits_ulong_p (x, (mpfr_rnd_t) r))
-+ ERROR1 (13);
-+ if (!mpfr_fits_slong_p (x, (mpfr_rnd_t) r))
-+ ERROR1 (14);
-+ if (!mpfr_fits_uint_p (x, (mpfr_rnd_t) r))
-+ ERROR1 (15);
-+ if (!mpfr_fits_sint_p (x, (mpfr_rnd_t) r))
-+ ERROR1 (16);
-+ if (!mpfr_fits_ushort_p (x, (mpfr_rnd_t) r))
-+ ERROR1 (17);
-+ if (!mpfr_fits_sshort_p (x, (mpfr_rnd_t) r))
-+ ERROR1 (18);
-
-- /* Check 17 */
-- mpfr_set_ui (x, 17, MPFR_RNDN);
-- if (!mpfr_fits_ulong_p (x, MPFR_RNDN))
-- ERROR2;
-- if (!mpfr_fits_slong_p (x, MPFR_RNDN))
-- ERROR2;
-- if (!mpfr_fits_uint_p (x, MPFR_RNDN))
-- ERROR2;
-- if (!mpfr_fits_sint_p (x, MPFR_RNDN))
-- ERROR2;
-- if (!mpfr_fits_ushort_p (x, MPFR_RNDN))
-- ERROR2;
-- if (!mpfr_fits_sshort_p (x, MPFR_RNDN))
-- ERROR2;
-+ /* Check small positive op */
-+ mpfr_set_str1 (x, "1@-1");
-+ if (!mpfr_fits_ulong_p (x, (mpfr_rnd_t) r))
-+ ERROR1 (19);
-+ if (!mpfr_fits_slong_p (x, (mpfr_rnd_t) r))
-+ ERROR1 (20);
-+ if (!mpfr_fits_uint_p (x, (mpfr_rnd_t) r))
-+ ERROR1 (21);
-+ if (!mpfr_fits_sint_p (x, (mpfr_rnd_t) r))
-+ ERROR1 (22);
-+ if (!mpfr_fits_ushort_p (x, (mpfr_rnd_t) r))
-+ ERROR1 (23);
-+ if (!mpfr_fits_sshort_p (x, (mpfr_rnd_t) r))
-+ ERROR1 (24);
-
-- /* Check all other values */
-- mpfr_set_ui (x, ULONG_MAX, MPFR_RNDN);
-- mpfr_mul_2exp (x, x, 1, MPFR_RNDN);
-- if (mpfr_fits_ulong_p (x, MPFR_RNDN))
-- ERROR1;
-- if (mpfr_fits_slong_p (x, MPFR_RNDN))
-- ERROR1;
-- mpfr_mul_2exp (x, x, 40, MPFR_RNDN);
-- if (mpfr_fits_ulong_p (x, MPFR_RNDN))
-- ERROR1;
-- if (mpfr_fits_uint_p (x, MPFR_RNDN))
-- ERROR1;
-- if (mpfr_fits_sint_p (x, MPFR_RNDN))
-- ERROR1;
-- if (mpfr_fits_ushort_p (x, MPFR_RNDN))
-- ERROR1;
-- if (mpfr_fits_sshort_p (x, MPFR_RNDN))
-- ERROR1;
-+ /* Check 17 */
-+ mpfr_set_ui (x, 17, MPFR_RNDN);
-+ if (!mpfr_fits_ulong_p (x, (mpfr_rnd_t) r))
-+ ERROR1 (25);
-+ if (!mpfr_fits_slong_p (x, (mpfr_rnd_t) r))
-+ ERROR1 (26);
-+ if (!mpfr_fits_uint_p (x, (mpfr_rnd_t) r))
-+ ERROR1 (27);
-+ if (!mpfr_fits_sint_p (x, (mpfr_rnd_t) r))
-+ ERROR1 (28);
-+ if (!mpfr_fits_ushort_p (x, (mpfr_rnd_t) r))
-+ ERROR1 (29);
-+ if (!mpfr_fits_sshort_p (x, (mpfr_rnd_t) r))
-+ ERROR1 (30);
-
-- mpfr_set_ui (x, ULONG_MAX, MPFR_RNDN);
-- if (!mpfr_fits_ulong_p (x, MPFR_RNDN))
-- ERROR2;
-- mpfr_set_ui (x, LONG_MAX, MPFR_RNDN);
-- if (!mpfr_fits_slong_p (x, MPFR_RNDN))
-- ERROR2;
-- mpfr_set_ui (x, UINT_MAX, MPFR_RNDN);
-- if (!mpfr_fits_uint_p (x, MPFR_RNDN))
-- ERROR2;
-- mpfr_set_ui (x, INT_MAX, MPFR_RNDN);
-- if (!mpfr_fits_sint_p (x, MPFR_RNDN))
-- ERROR2;
-- mpfr_set_ui (x, USHRT_MAX, MPFR_RNDN);
-- if (!mpfr_fits_ushort_p (x, MPFR_RNDN))
-- ERROR2;
-- mpfr_set_ui (x, SHRT_MAX, MPFR_RNDN);
-- if (!mpfr_fits_sshort_p (x, MPFR_RNDN))
-- ERROR2;
-+ /* Check all other values */
-+ mpfr_set_ui (x, ULONG_MAX, MPFR_RNDN);
-+ mpfr_mul_2exp (x, x, 1, MPFR_RNDN);
-+ if (mpfr_fits_ulong_p (x, (mpfr_rnd_t) r))
-+ ERROR1 (31);
-+ if (mpfr_fits_slong_p (x, (mpfr_rnd_t) r))
-+ ERROR1 (32);
-+ mpfr_mul_2exp (x, x, 40, MPFR_RNDN);
-+ if (mpfr_fits_ulong_p (x, (mpfr_rnd_t) r))
-+ ERROR1 (33);
-+ if (mpfr_fits_uint_p (x, (mpfr_rnd_t) r))
-+ ERROR1 (34);
-+ if (mpfr_fits_sint_p (x, (mpfr_rnd_t) r))
-+ ERROR1 (35);
-+ if (mpfr_fits_ushort_p (x, (mpfr_rnd_t) r))
-+ ERROR1 (36);
-+ if (mpfr_fits_sshort_p (x, (mpfr_rnd_t) r))
-+ ERROR1 (37);
-
-- mpfr_set_si (x, 1, MPFR_RNDN);
-- if (!mpfr_fits_sint_p (x, MPFR_RNDN))
-- ERROR2;
-- if (!mpfr_fits_sshort_p (x, MPFR_RNDN))
-- ERROR2;
-+ mpfr_set_ui (x, ULONG_MAX, MPFR_RNDN);
-+ if (!mpfr_fits_ulong_p (x, (mpfr_rnd_t) r))
-+ ERROR1 (38);
-+ mpfr_set_ui (x, LONG_MAX, MPFR_RNDN);
-+ if (!mpfr_fits_slong_p (x, (mpfr_rnd_t) r))
-+ ERROR1 (39);
-+ mpfr_set_ui (x, UINT_MAX, MPFR_RNDN);
-+ if (!mpfr_fits_uint_p (x, (mpfr_rnd_t) r))
-+ ERROR1 (40);
-+ mpfr_set_ui (x, INT_MAX, MPFR_RNDN);
-+ if (!mpfr_fits_sint_p (x, (mpfr_rnd_t) r))
-+ ERROR1 (41);
-+ mpfr_set_ui (x, USHRT_MAX, MPFR_RNDN);
-+ if (!mpfr_fits_ushort_p (x, (mpfr_rnd_t) r))
-+ ERROR1 (42);
-+ mpfr_set_ui (x, SHRT_MAX, MPFR_RNDN);
-+ if (!mpfr_fits_sshort_p (x, (mpfr_rnd_t) r))
-+ ERROR1 (43);
-
-- /* Check negative value */
-- mpfr_set_si (x, -1, MPFR_RNDN);
-- if (!mpfr_fits_sint_p (x, MPFR_RNDN))
-- ERROR2;
-- if (!mpfr_fits_sshort_p (x, MPFR_RNDN))
-- ERROR2;
-- if (!mpfr_fits_slong_p (x, MPFR_RNDN))
-- ERROR2;
-- if (mpfr_fits_uint_p (x, MPFR_RNDN))
-- ERROR1;
-- if (mpfr_fits_ushort_p (x, MPFR_RNDN))
-- ERROR1;
-- if (mpfr_fits_ulong_p (x, MPFR_RNDN))
-- ERROR1;
-+ mpfr_set_si (x, 1, MPFR_RNDN);
-+ if (!mpfr_fits_sint_p (x, (mpfr_rnd_t) r))
-+ ERROR1 (44);
-+ if (!mpfr_fits_sshort_p (x, (mpfr_rnd_t) r))
-+ ERROR1 (45);
-+
-+ /* Check negative op */
-+ for (i = 1; i <= 4; i++)
-+ {
-+ int inv;
-+
-+ mpfr_set_si_2exp (x, -i, -2, MPFR_RNDN);
-+ mpfr_rint (y, x, (mpfr_rnd_t) r);
-+ inv = MPFR_NOTZERO (y);
-+ if (!mpfr_fits_ulong_p (x, (mpfr_rnd_t) r) ^ inv)
-+ ERROR1 (46);
-+ if (!mpfr_fits_slong_p (x, (mpfr_rnd_t) r))
-+ ERROR1 (47);
-+ if (!mpfr_fits_uint_p (x, (mpfr_rnd_t) r) ^ inv)
-+ ERROR1 (48);
-+ if (!mpfr_fits_sint_p (x, (mpfr_rnd_t) r))
-+ ERROR1 (49);
-+ if (!mpfr_fits_ushort_p (x, (mpfr_rnd_t) r) ^ inv)
-+ ERROR1 (50);
-+ if (!mpfr_fits_sshort_p (x, (mpfr_rnd_t) r))
-+ ERROR1 (51);
-+ }
-+ }
-
- mpfr_clear (x);
-+ mpfr_clear (y);
-
- check_intmax ();
-
-@@ -189,85 +210,98 @@
- return 0;
- }
-
--static void check_intmax (void)
-+static void
-+check_intmax (void)
- {
- #ifdef _MPFR_H_HAVE_INTMAX_T
-- mpfr_t x;
-+ mpfr_t x, y;
-+ int i, r;
-
-- mpfr_init2 (x, sizeof (uintmax_t)*CHAR_BIT);
-+ mpfr_init2 (x, sizeof (uintmax_t) * CHAR_BIT);
-+ mpfr_init2 (y, 8);
-
-- /* Check NAN */
-- mpfr_set_nan (x);
-- if (mpfr_fits_uintmax_p (x, MPFR_RNDN))
-- ERROR1;
-- if (mpfr_fits_intmax_p (x, MPFR_RNDN))
-- ERROR1;
-+ RND_LOOP (r)
-+ {
-+ /* Check NAN */
-+ mpfr_set_nan (x);
-+ if (mpfr_fits_uintmax_p (x, (mpfr_rnd_t) r))
-+ ERROR1 (52);
-+ if (mpfr_fits_intmax_p (x, (mpfr_rnd_t) r))
-+ ERROR1 (53);
-
-- /* Check INF */
-- mpfr_set_inf (x, 1);
-- if (mpfr_fits_uintmax_p (x, MPFR_RNDN))
-- ERROR1;
-- if (mpfr_fits_intmax_p (x, MPFR_RNDN))
-- ERROR1;
-+ /* Check INF */
-+ mpfr_set_inf (x, 1);
-+ if (mpfr_fits_uintmax_p (x, (mpfr_rnd_t) r))
-+ ERROR1 (54);
-+ if (mpfr_fits_intmax_p (x, (mpfr_rnd_t) r))
-+ ERROR1 (55);
-
-- /* Check Zero */
-- MPFR_SET_ZERO (x);
-- if (!mpfr_fits_uintmax_p (x, MPFR_RNDN))
-- ERROR2;
-- if (!mpfr_fits_intmax_p (x, MPFR_RNDN))
-- ERROR2;
-+ /* Check Zero */
-+ MPFR_SET_ZERO (x);
-+ if (!mpfr_fits_uintmax_p (x, (mpfr_rnd_t) r))
-+ ERROR1 (56);
-+ if (!mpfr_fits_intmax_p (x, (mpfr_rnd_t) r))
-+ ERROR1 (57);
-
-- /* Check small op */
-- mpfr_set_str1 (x, "1@-1");
-- if (!mpfr_fits_uintmax_p (x, MPFR_RNDN))
-- ERROR2;
-- if (!mpfr_fits_intmax_p (x, MPFR_RNDN))
-- ERROR2;
-+ /* Check positive small op */
-+ mpfr_set_str1 (x, "1@-1");
-+ if (!mpfr_fits_uintmax_p (x, (mpfr_rnd_t) r))
-+ ERROR1 (58);
-+ if (!mpfr_fits_intmax_p (x, (mpfr_rnd_t) r))
-+ ERROR1 (59);
-
-- /* Check 17 */
-- mpfr_set_ui (x, 17, MPFR_RNDN);
-- if (!mpfr_fits_uintmax_p (x, MPFR_RNDN))
-- ERROR2;
-- if (!mpfr_fits_intmax_p (x, MPFR_RNDN))
-- ERROR2;
-+ /* Check 17 */
-+ mpfr_set_ui (x, 17, MPFR_RNDN);
-+ if (!mpfr_fits_uintmax_p (x, (mpfr_rnd_t) r))
-+ ERROR1 (60);
-+ if (!mpfr_fits_intmax_p (x, (mpfr_rnd_t) r))
-+ ERROR1 (61);
-
-- /* Check hugest */
-- mpfr_set_ui_2exp (x, 42, sizeof (uintmax_t) * 32, MPFR_RNDN);
-- if (mpfr_fits_uintmax_p (x, MPFR_RNDN))
-- ERROR1;
-- if (mpfr_fits_intmax_p (x, MPFR_RNDN))
-- ERROR1;
-+ /* Check hugest */
-+ mpfr_set_ui_2exp (x, 42, sizeof (uintmax_t) * 32, MPFR_RNDN);
-+ if (mpfr_fits_uintmax_p (x, (mpfr_rnd_t) r))
-+ ERROR1 (62);
-+ if (mpfr_fits_intmax_p (x, (mpfr_rnd_t) r))
-+ ERROR1 (63);
-
-- /* Check all other values */
-- mpfr_set_uj (x, MPFR_UINTMAX_MAX, MPFR_RNDN);
-- mpfr_add_ui (x, x, 1, MPFR_RNDN);
-- if (mpfr_fits_uintmax_p (x, MPFR_RNDN))
-- ERROR1;
-- mpfr_set_uj (x, MPFR_UINTMAX_MAX, MPFR_RNDN);
-- if (!mpfr_fits_uintmax_p (x, MPFR_RNDN))
-- ERROR2;
-- mpfr_set_sj (x, MPFR_INTMAX_MAX, MPFR_RNDN);
-- mpfr_add_ui (x, x, 1, MPFR_RNDN);
-- if (mpfr_fits_intmax_p (x, MPFR_RNDN))
-- ERROR1;
-- mpfr_set_sj (x, MPFR_INTMAX_MAX, MPFR_RNDN);
-- if (!mpfr_fits_intmax_p (x, MPFR_RNDN))
-- ERROR2;
-- mpfr_set_sj (x, MPFR_INTMAX_MIN, MPFR_RNDN);
-- if (!mpfr_fits_intmax_p (x, MPFR_RNDN))
-- ERROR2;
-- mpfr_sub_ui (x, x, 1, MPFR_RNDN);
-- if (mpfr_fits_intmax_p (x, MPFR_RNDN))
-- ERROR1;
-+ /* Check all other values */
-+ mpfr_set_uj (x, MPFR_UINTMAX_MAX, MPFR_RNDN);
-+ mpfr_add_ui (x, x, 1, MPFR_RNDN);
-+ if (mpfr_fits_uintmax_p (x, (mpfr_rnd_t) r))
-+ ERROR1 (64);
-+ mpfr_set_uj (x, MPFR_UINTMAX_MAX, MPFR_RNDN);
-+ if (!mpfr_fits_uintmax_p (x, (mpfr_rnd_t) r))
-+ ERROR1 (65);
-+ mpfr_set_sj (x, MPFR_INTMAX_MAX, MPFR_RNDN);
-+ mpfr_add_ui (x, x, 1, MPFR_RNDN);
-+ if (mpfr_fits_intmax_p (x, (mpfr_rnd_t) r))
-+ ERROR1 (66);
-+ mpfr_set_sj (x, MPFR_INTMAX_MAX, MPFR_RNDN);
-+ if (!mpfr_fits_intmax_p (x, (mpfr_rnd_t) r))
-+ ERROR1 (67);
-+ mpfr_set_sj (x, MPFR_INTMAX_MIN, MPFR_RNDN);
-+ if (!mpfr_fits_intmax_p (x, (mpfr_rnd_t) r))
-+ ERROR1 (68);
-+ mpfr_sub_ui (x, x, 1, MPFR_RNDN);
-+ if (mpfr_fits_intmax_p (x, (mpfr_rnd_t) r))
-+ ERROR1 (69);
-
-- /* Check negative value */
-- mpfr_set_si (x, -1, MPFR_RNDN);
-- if (!mpfr_fits_intmax_p (x, MPFR_RNDN))
-- ERROR2;
-- if (mpfr_fits_uintmax_p (x, MPFR_RNDN))
-- ERROR1;
-+ /* Check negative op */
-+ for (i = 1; i <= 4; i++)
-+ {
-+ int inv;
-+
-+ mpfr_set_si_2exp (x, -i, -2, MPFR_RNDN);
-+ mpfr_rint (y, x, (mpfr_rnd_t) r);
-+ inv = MPFR_NOTZERO (y);
-+ if (!mpfr_fits_uintmax_p (x, (mpfr_rnd_t) r) ^ inv)
-+ ERROR1 (70);
-+ if (!mpfr_fits_intmax_p (x, (mpfr_rnd_t) r))
-+ ERROR1 (71);
-+ }
-+ }
-
- mpfr_clear (x);
-+ mpfr_clear (y);
- #endif
- }
--
-diff -Naurd mpfr-3.1.2-a/PATCHES mpfr-3.1.2-b/PATCHES
---- mpfr-3.1.2-a/PATCHES 2013-10-09 13:34:21.000000000 +0000
-+++ mpfr-3.1.2-b/PATCHES 2013-10-09 13:34:21.000000000 +0000
-@@ -0,0 +1 @@
-+clang-divby0
-diff -Naurd mpfr-3.1.2-a/VERSION mpfr-3.1.2-b/VERSION
---- mpfr-3.1.2-a/VERSION 2013-09-26 10:52:52.000000000 +0000
-+++ mpfr-3.1.2-b/VERSION 2013-10-09 13:34:21.000000000 +0000
-@@ -1 +1 @@
--3.1.2-p2
-+3.1.2-p3
-diff -Naurd mpfr-3.1.2-a/src/mpfr-impl.h mpfr-3.1.2-b/src/mpfr-impl.h
---- mpfr-3.1.2-a/src/mpfr-impl.h 2013-03-13 15:37:36.000000000 +0000
-+++ mpfr-3.1.2-b/src/mpfr-impl.h 2013-10-09 13:34:21.000000000 +0000
-@@ -468,8 +468,16 @@
- #define MPFR_LIMBS_PER_FLT ((IEEE_FLT_MANT_DIG-1)/GMP_NUMB_BITS+1)
-
- /* Visual C++ doesn't support +1.0/0.0, -1.0/0.0 and 0.0/0.0
-- at compile time. */
--#if defined(_MSC_VER) && defined(_WIN32) && (_MSC_VER >= 1200)
-+ at compile time.
-+ Clang with -fsanitize=undefined is a bit similar due to a bug:
-+ http://llvm.org/bugs/show_bug.cgi?id=17381
-+ but even without its sanitizer, it may be better to use the
-+ double_zero version until IEEE 754 division by zero is properly
-+ supported:
-+ http://llvm.org/bugs/show_bug.cgi?id=17000
-+*/
-+#if (defined(_MSC_VER) && defined(_WIN32) && (_MSC_VER >= 1200)) || \
-+ defined(__clang__)
- static double double_zero = 0.0;
- # define DBL_NAN (double_zero/double_zero)
- # define DBL_POS_INF ((double) 1.0/double_zero)
-@@ -501,6 +509,8 @@
- (with Xcode 2.4.1, i.e. the latest one). */
- #define LVALUE(x) (&(x) == &(x) || &(x) != &(x))
- #define DOUBLE_ISINF(x) (LVALUE(x) && ((x) > DBL_MAX || (x) < -DBL_MAX))
-+/* The DOUBLE_ISNAN(x) macro is also valid on long double x
-+ (assuming that the compiler isn't too broken). */
- #ifdef MPFR_NANISNAN
- /* Avoid MIPSpro / IRIX64 / gcc -ffast-math (incorrect) optimizations.
- The + must not be replaced by a ||. With gcc -ffast-math, NaN is
-diff -Naurd mpfr-3.1.2-a/src/mpfr.h mpfr-3.1.2-b/src/mpfr.h
---- mpfr-3.1.2-a/src/mpfr.h 2013-09-26 10:52:52.000000000 +0000
-+++ mpfr-3.1.2-b/src/mpfr.h 2013-10-09 13:34:21.000000000 +0000
-@@ -27,7 +27,7 @@
- #define MPFR_VERSION_MAJOR 3
- #define MPFR_VERSION_MINOR 1
- #define MPFR_VERSION_PATCHLEVEL 2
--#define MPFR_VERSION_STRING "3.1.2-p2"
-+#define MPFR_VERSION_STRING "3.1.2-p3"
-
- /* Macros dealing with MPFR VERSION */
- #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
-diff -Naurd mpfr-3.1.2-a/src/version.c mpfr-3.1.2-b/src/version.c
---- mpfr-3.1.2-a/src/version.c 2013-09-26 10:52:52.000000000 +0000
-+++ mpfr-3.1.2-b/src/version.c 2013-10-09 13:34:21.000000000 +0000
-@@ -25,5 +25,5 @@
- const char *
- mpfr_get_version (void)
- {
-- return "3.1.2-p2";
-+ return "3.1.2-p3";
- }
-diff -Naurd mpfr-3.1.2-a/tests/tget_flt.c mpfr-3.1.2-b/tests/tget_flt.c
---- mpfr-3.1.2-a/tests/tget_flt.c 2013-03-13 15:37:44.000000000 +0000
-+++ mpfr-3.1.2-b/tests/tget_flt.c 2013-10-09 13:34:21.000000000 +0000
-@@ -28,9 +28,17 @@
- main (void)
- {
- mpfr_t x, y;
-- float f, g, infp;
-+ float f, g;
- int i;
-+#if !defined(MPFR_ERRDIVZERO)
-+ float infp;
-+#endif
-+
-+ tests_start_mpfr ();
-
-+#if !defined(MPFR_ERRDIVZERO)
-+ /* The definition of DBL_POS_INF involves a division by 0. This makes
-+ "clang -O2 -fsanitize=undefined -fno-sanitize-recover" fail. */
- infp = (float) DBL_POS_INF;
- if (infp * 0.5 != infp)
- {
-@@ -38,8 +46,7 @@
- fprintf (stderr, "(this is probably a compiler bug, please report)\n");
- exit (1);
- }
--
-- tests_start_mpfr ();
-+#endif
-
- mpfr_init2 (x, 24);
- mpfr_init2 (y, 24);
-@@ -353,6 +360,7 @@
- printf ("expected %.8e, got %.8e\n", g, f);
- exit (1);
- }
-+#if !defined(MPFR_ERRDIVZERO)
- f = mpfr_get_flt (x, MPFR_RNDN); /* first round to 2^128 (even rule),
- thus we should get +Inf */
- g = infp;
-@@ -376,6 +384,7 @@
- printf ("expected %.8e, got %.8e\n", g, f);
- exit (1);
- }
-+#endif
-
- mpfr_clear (x);
- mpfr_clear (y);
-diff -Naurd mpfr-3.1.2-a/tests/tset_ld.c mpfr-3.1.2-b/tests/tset_ld.c
---- mpfr-3.1.2-a/tests/tset_ld.c 2013-03-13 15:37:44.000000000 +0000
-+++ mpfr-3.1.2-b/tests/tset_ld.c 2013-10-09 13:34:21.000000000 +0000
-@@ -47,8 +47,11 @@
- static int
- Isnan_ld (long double d)
- {
-- double e = (double) d;
-- if (DOUBLE_ISNAN (e))
-+ /* Do not convert d to double as this can give an overflow, which
-+ may confuse compilers without IEEE 754 support (such as clang
-+ -fsanitize=undefined), or trigger a trap if enabled.
-+ The DOUBLE_ISNAN macro should work fine on long double. */
-+ if (DOUBLE_ISNAN (d))
- return 1;
- LONGDOUBLE_NAN_ACTION (d, goto yes);
- return 0;
-diff -Naurd mpfr-3.1.2-a/PATCHES mpfr-3.1.2-b/PATCHES
---- mpfr-3.1.2-a/PATCHES 2013-11-15 00:51:49.211333830 +0000
-+++ mpfr-3.1.2-b/PATCHES 2013-11-15 00:51:49.323334999 +0000
-@@ -0,0 +1 @@
-+printf-alt0
-diff -Naurd mpfr-3.1.2-a/VERSION mpfr-3.1.2-b/VERSION
---- mpfr-3.1.2-a/VERSION 2013-11-15 00:51:49.211333830 +0000
-+++ mpfr-3.1.2-b/VERSION 2013-11-15 00:51:49.323334999 +0000
-@@ -1 +1 @@
--3.1.2-p3
-+3.1.2-p4
-diff -Naurd mpfr-3.1.2-a/src/mpfr.h mpfr-3.1.2-b/src/mpfr.h
---- mpfr-3.1.2-a/src/mpfr.h 2013-11-15 00:51:49.211333830 +0000
-+++ mpfr-3.1.2-b/src/mpfr.h 2013-11-15 00:51:49.323334999 +0000
-@@ -27,7 +27,7 @@
- #define MPFR_VERSION_MAJOR 3
- #define MPFR_VERSION_MINOR 1
- #define MPFR_VERSION_PATCHLEVEL 2
--#define MPFR_VERSION_STRING "3.1.2-p3"
-+#define MPFR_VERSION_STRING "3.1.2-p4"
-
- /* Macros dealing with MPFR VERSION */
- #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
-diff -Naurd mpfr-3.1.2-a/src/vasprintf.c mpfr-3.1.2-b/src/vasprintf.c
---- mpfr-3.1.2-a/src/vasprintf.c 2013-03-13 15:37:37.000000000 +0000
-+++ mpfr-3.1.2-b/src/vasprintf.c 2013-11-15 00:51:49.267334408 +0000
-@@ -1040,7 +1040,7 @@
- }
-
- /* Determine the different parts of the string representation of the regular
-- number P when SPEC.SPEC is 'e', 'E', 'g', or 'G'.
-+ number P when spec.spec is 'e', 'E', 'g', or 'G'.
- DEC_INFO contains the previously computed exponent and string or is NULL.
-
- return -1 if some field > INT_MAX */
-@@ -1167,7 +1167,7 @@
- }
-
- /* Determine the different parts of the string representation of the regular
-- number P when SPEC.SPEC is 'f', 'F', 'g', or 'G'.
-+ number P when spec.spec is 'f', 'F', 'g', or 'G'.
- DEC_INFO contains the previously computed exponent and string or is NULL.
-
- return -1 if some field of number_parts is greater than INT_MAX */
-@@ -1559,7 +1559,7 @@
- /* fractional part */
- {
- np->point = MPFR_DECIMAL_POINT;
-- np->fp_trailing_zeros = (spec.spec == 'g' && spec.spec == 'G') ?
-+ np->fp_trailing_zeros = (spec.spec == 'g' || spec.spec == 'G') ?
- spec.prec - 1 : spec.prec;
- }
- else if (spec.alt)
-diff -Naurd mpfr-3.1.2-a/src/version.c mpfr-3.1.2-b/src/version.c
---- mpfr-3.1.2-a/src/version.c 2013-11-15 00:51:49.211333830 +0000
-+++ mpfr-3.1.2-b/src/version.c 2013-11-15 00:51:49.323334999 +0000
-@@ -25,5 +25,5 @@
- const char *
- mpfr_get_version (void)
- {
-- return "3.1.2-p3";
-+ return "3.1.2-p4";
- }
-diff -Naurd mpfr-3.1.2-a/tests/tsprintf.c mpfr-3.1.2-b/tests/tsprintf.c
---- mpfr-3.1.2-a/tests/tsprintf.c 2013-03-13 15:37:44.000000000 +0000
-+++ mpfr-3.1.2-b/tests/tsprintf.c 2013-11-15 00:51:49.267334408 +0000
-@@ -456,10 +456,16 @@
- check_sprintf ("1.999900 ", "%-#10.7RG", x);
- check_sprintf ("1.9999 ", "%-10.7RG", x);
- mpfr_set_ui (x, 1, MPFR_RNDN);
-+ check_sprintf ("1.", "%#.1Rg", x);
-+ check_sprintf ("1. ", "%-#5.1Rg", x);
-+ check_sprintf (" 1.0", "%#5.2Rg", x);
- check_sprintf ("1.00000000000000000000000000000", "%#.30Rg", x);
- check_sprintf ("1", "%.30Rg", x);
- mpfr_set_ui (x, 0, MPFR_RNDN);
-- check_sprintf ("0.000000000000000000000000000000", "%#.30Rg", x);
-+ check_sprintf ("0.", "%#.1Rg", x);
-+ check_sprintf ("0. ", "%-#5.1Rg", x);
-+ check_sprintf (" 0.0", "%#5.2Rg", x);
-+ check_sprintf ("0.00000000000000000000000000000", "%#.30Rg", x);
- check_sprintf ("0", "%.30Rg", x);
-
- /* following tests with precision 53 bits */
-diff -Naurd mpfr-3.1.2-a/PATCHES mpfr-3.1.2-b/PATCHES
---- mpfr-3.1.2-a/PATCHES 2013-12-01 11:07:49.575329762 +0000
-+++ mpfr-3.1.2-b/PATCHES 2013-12-01 11:07:49.751331625 +0000
-@@ -0,0 +1 @@
-+custom_init_set
-diff -Naurd mpfr-3.1.2-a/VERSION mpfr-3.1.2-b/VERSION
---- mpfr-3.1.2-a/VERSION 2013-12-01 11:07:49.571329714 +0000
-+++ mpfr-3.1.2-b/VERSION 2013-12-01 11:07:49.747331585 +0000
-@@ -1 +1 @@
--3.1.2-p4
-+3.1.2-p5
-diff -Naurd mpfr-3.1.2-a/src/mpfr.h mpfr-3.1.2-b/src/mpfr.h
---- mpfr-3.1.2-a/src/mpfr.h 2013-12-01 11:07:49.571329714 +0000
-+++ mpfr-3.1.2-b/src/mpfr.h 2013-12-01 11:07:49.747331585 +0000
-@@ -27,7 +27,7 @@
- #define MPFR_VERSION_MAJOR 3
- #define MPFR_VERSION_MINOR 1
- #define MPFR_VERSION_PATCHLEVEL 2
--#define MPFR_VERSION_STRING "3.1.2-p4"
-+#define MPFR_VERSION_STRING "3.1.2-p5"
-
- /* Macros dealing with MPFR VERSION */
- #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
-@@ -861,7 +861,7 @@
- _t = (mpfr_kind_t) _k; \
- _s = 1; \
- } else { \
-- _t = (mpfr_kind_t) -k; \
-+ _t = (mpfr_kind_t) - _k; \
- _s = -1; \
- } \
- _e = _t == MPFR_REGULAR_KIND ? (e) : \
-diff -Naurd mpfr-3.1.2-a/src/version.c mpfr-3.1.2-b/src/version.c
---- mpfr-3.1.2-a/src/version.c 2013-12-01 11:07:49.575329762 +0000
-+++ mpfr-3.1.2-b/src/version.c 2013-12-01 11:07:49.747331585 +0000
-@@ -25,5 +25,5 @@
- const char *
- mpfr_get_version (void)
- {
-- return "3.1.2-p4";
-+ return "3.1.2-p5";
- }
-diff -Naurd mpfr-3.1.2-a/PATCHES mpfr-3.1.2-b/PATCHES
---- mpfr-3.1.2-a/PATCHES 2014-04-15 21:56:49.609057464 +0000
-+++ mpfr-3.1.2-b/PATCHES 2014-04-15 21:56:49.697059857 +0000
-@@ -0,0 +1 @@
-+li2-return
-diff -Naurd mpfr-3.1.2-a/VERSION mpfr-3.1.2-b/VERSION
---- mpfr-3.1.2-a/VERSION 2014-04-15 21:56:49.609057464 +0000
-+++ mpfr-3.1.2-b/VERSION 2014-04-15 21:56:49.697059857 +0000
-@@ -1 +1 @@
--3.1.2-p5
-+3.1.2-p6
-diff -Naurd mpfr-3.1.2-a/src/li2.c mpfr-3.1.2-b/src/li2.c
---- mpfr-3.1.2-a/src/li2.c 2013-03-13 15:37:32.000000000 +0000
-+++ mpfr-3.1.2-b/src/li2.c 2014-04-15 21:56:49.653058661 +0000
-@@ -630,5 +630,5 @@
- return mpfr_check_range (y, inexact, rnd_mode);
- }
-
-- MPFR_ASSERTN (0); /* should never reach this point */
-+ MPFR_RET_NEVER_GO_HERE ();
- }
-diff -Naurd mpfr-3.1.2-a/src/mpfr.h mpfr-3.1.2-b/src/mpfr.h
---- mpfr-3.1.2-a/src/mpfr.h 2014-04-15 21:56:49.609057464 +0000
-+++ mpfr-3.1.2-b/src/mpfr.h 2014-04-15 21:56:49.697059857 +0000
-@@ -27,7 +27,7 @@
- #define MPFR_VERSION_MAJOR 3
- #define MPFR_VERSION_MINOR 1
- #define MPFR_VERSION_PATCHLEVEL 2
--#define MPFR_VERSION_STRING "3.1.2-p5"
-+#define MPFR_VERSION_STRING "3.1.2-p6"
-
- /* Macros dealing with MPFR VERSION */
- #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
-diff -Naurd mpfr-3.1.2-a/src/version.c mpfr-3.1.2-b/src/version.c
---- mpfr-3.1.2-a/src/version.c 2014-04-15 21:56:49.609057464 +0000
-+++ mpfr-3.1.2-b/src/version.c 2014-04-15 21:56:49.697059857 +0000
-@@ -25,5 +25,5 @@
- const char *
- mpfr_get_version (void)
- {
-- return "3.1.2-p5";
-+ return "3.1.2-p6";
- }
-diff -Naurd mpfr-3.1.2-a/PATCHES mpfr-3.1.2-b/PATCHES
---- mpfr-3.1.2-a/PATCHES 2014-04-15 22:04:57.090286262 +0000
-+++ mpfr-3.1.2-b/PATCHES 2014-04-15 22:04:57.162288198 +0000
-@@ -0,0 +1 @@
-+exp3
-diff -Naurd mpfr-3.1.2-a/VERSION mpfr-3.1.2-b/VERSION
---- mpfr-3.1.2-a/VERSION 2014-04-15 22:04:57.086286154 +0000
-+++ mpfr-3.1.2-b/VERSION 2014-04-15 22:04:57.162288198 +0000
-@@ -1 +1 @@
--3.1.2-p6
-+3.1.2-p7
-diff -Naurd mpfr-3.1.2-a/src/exp3.c mpfr-3.1.2-b/src/exp3.c
---- mpfr-3.1.2-a/src/exp3.c 2013-03-13 15:37:34.000000000 +0000
-+++ mpfr-3.1.2-b/src/exp3.c 2014-04-15 22:04:57.126287230 +0000
-@@ -283,7 +283,7 @@
- }
- }
-
-- if (mpfr_can_round (shift_x > 0 ? t : tmp, realprec, MPFR_RNDD, MPFR_RNDZ,
-+ if (mpfr_can_round (shift_x > 0 ? t : tmp, realprec, MPFR_RNDN, MPFR_RNDZ,
- MPFR_PREC(y) + (rnd_mode == MPFR_RNDN)))
- {
- inexact = mpfr_set (y, shift_x > 0 ? t : tmp, rnd_mode);
-diff -Naurd mpfr-3.1.2-a/src/mpfr.h mpfr-3.1.2-b/src/mpfr.h
---- mpfr-3.1.2-a/src/mpfr.h 2014-04-15 22:04:57.086286154 +0000
-+++ mpfr-3.1.2-b/src/mpfr.h 2014-04-15 22:04:57.162288198 +0000
-@@ -27,7 +27,7 @@
- #define MPFR_VERSION_MAJOR 3
- #define MPFR_VERSION_MINOR 1
- #define MPFR_VERSION_PATCHLEVEL 2
--#define MPFR_VERSION_STRING "3.1.2-p6"
-+#define MPFR_VERSION_STRING "3.1.2-p7"
-
- /* Macros dealing with MPFR VERSION */
- #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
-diff -Naurd mpfr-3.1.2-a/src/version.c mpfr-3.1.2-b/src/version.c
---- mpfr-3.1.2-a/src/version.c 2014-04-15 22:04:57.090286262 +0000
-+++ mpfr-3.1.2-b/src/version.c 2014-04-15 22:04:57.162288198 +0000
-@@ -25,5 +25,5 @@
- const char *
- mpfr_get_version (void)
- {
-- return "3.1.2-p6";
-+ return "3.1.2-p7";
- }
-diff -Naurd mpfr-3.1.2-a/tests/texp.c mpfr-3.1.2-b/tests/texp.c
---- mpfr-3.1.2-a/tests/texp.c 2013-03-13 15:37:44.000000000 +0000
-+++ mpfr-3.1.2-b/tests/texp.c 2014-04-15 22:04:57.126287230 +0000
-@@ -150,6 +150,22 @@
- exit (1);
- }
-
-+ mpfr_set_prec (x, 118);
-+ mpfr_set_str_binary (x, "0.1110010100011101010000111110011000000000000000000000000000000000000000000000000000000000000000000000000000000000000000E-86");
-+ mpfr_set_prec (y, 118);
-+ mpfr_exp_2 (y, x, MPFR_RNDU);
-+ mpfr_exp_3 (x, x, MPFR_RNDU);
-+ if (mpfr_cmp (x, y))
-+ {
-+ printf ("mpfr_exp_2 and mpfr_exp_3 differ for prec=118\n");
-+ printf ("mpfr_exp_2 gives ");
-+ mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN);
-+ printf ("\nmpfr_exp_3 gives ");
-+ mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN);
-+ printf ("\n");
-+ exit (1);
-+ }
-+
- mpfr_clear (x);
- mpfr_clear (y);
- return 0;
-diff -Naurd mpfr-3.1.2-a/PATCHES mpfr-3.1.2-b/PATCHES
---- mpfr-3.1.2-a/PATCHES 2014-04-15 22:20:32.243481506 +0000
-+++ mpfr-3.1.2-b/PATCHES 2014-04-15 22:22:32.418722707 +0000
-@@ -0,0 +1 @@
-+gmp6-compat
-diff -Naurd mpfr-3.1.2-a/VERSION mpfr-3.1.2-b/VERSION
---- mpfr-3.1.2-a/VERSION 2014-04-15 22:20:20.755171478 +0000
-+++ mpfr-3.1.2-b/VERSION 2014-04-15 22:21:45.225450147 +0000
-@@ -1 +1 @@
--3.1.2-p7
-+3.1.2-p8
-diff -Naurd mpfr-3.1.2-a/configure mpfr-3.1.2-b/configure
---- mpfr-3.1.2-a/configure 2013-03-13 15:38:20.000000000 +0000
-+++ mpfr-3.1.2-b/configure 2014-04-15 22:21:38.821277476 +0000
-@@ -14545,26 +14545,30 @@
- rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- fi
-
--if test "$use_gmp_build" = yes ; then
-- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for valid GMP_NUMB_BITS" >&5
--$as_echo_n "checking for valid GMP_NUMB_BITS... " >&6; }
-- if test "$cross_compiling" = yes; then :
-+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GMP_NUMB_BITS and sizeof(mp_limb_t) consistency" >&5
-+$as_echo_n "checking for GMP_NUMB_BITS and sizeof(mp_limb_t) consistency... " >&6; }
-+if test "$cross_compiling" = yes; then :
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: can't test" >&5
- $as_echo "can't test" >&6; }
- else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
- /* end confdefs.h. */
-
-+#include <stdio.h>
- #include <limits.h>
- #include "gmp.h"
--#include "gmp-impl.h"
-
- int
- main ()
- {
-
-- return GMP_NUMB_BITS == BYTES_PER_MP_LIMB * CHAR_BIT
-- && sizeof(mp_limb_t) == BYTES_PER_MP_LIMB ? 0 : 1;
-+ if (GMP_NUMB_BITS == sizeof(mp_limb_t) * CHAR_BIT)
-+ return 0;
-+ fprintf (stderr, "GMP_NUMB_BITS = %ld\n", (long) GMP_NUMB_BITS);
-+ fprintf (stderr, "sizeof(mp_limb_t) = %ld\n", (long) sizeof(mp_limb_t));
-+ fprintf (stderr, "sizeof(mp_limb_t) * CHAR_BIT = %ld != GMP_NUMB_BITS\n",
-+ (long) (sizeof(mp_limb_t) * CHAR_BIT));
-+ return 1;
-
- ;
- return 0;
-@@ -14577,14 +14581,14 @@
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
- $as_echo "no" >&6; }
-- as_fn_error $? "GMP_NUMB_BITS is incorrect.
--You probably need to change some of the GMP or MPFR compile options." "$LINENO" 5
-+ as_fn_error $? "GMP_NUMB_BITS and sizeof(mp_limb_t) are not consistent.
-+You probably need to change some of the GMP or MPFR compile options.
-+See 'config.log' for details (search for GMP_NUMB_BITS)." "$LINENO" 5
- fi
- rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
- conftest.$ac_objext conftest.beam conftest.$ac_ext
- fi
-
--fi
-
-
- if test "$dont_link_with_gmp" = yes ; then
-diff -Naurd mpfr-3.1.2-a/configure.ac mpfr-3.1.2-b/configure.ac
---- mpfr-3.1.2-a/configure.ac 2013-03-13 15:37:46.000000000 +0000
-+++ mpfr-3.1.2-b/configure.ac 2013-03-13 15:37:46.000000000 +0000
-@@ -435,23 +435,29 @@
- ])
- fi
-
--dnl Check for valid GMP_NUMB_BITS and BYTES_PER_MP_LIMB
-+dnl Check for GMP_NUMB_BITS and sizeof(mp_limb_t) consistency.
-+dnl Problems may occur if gmp.h was generated with some ABI
-+dnl and is used with another ABI (or if nails are used).
- dnl This test doesn't need to link with libgmp (at least it shouldn't).
--if test "$use_gmp_build" = yes ; then
-- AC_MSG_CHECKING(for valid GMP_NUMB_BITS)
-- AC_RUN_IFELSE([AC_LANG_PROGRAM([[
-+AC_MSG_CHECKING(for GMP_NUMB_BITS and sizeof(mp_limb_t) consistency)
-+AC_RUN_IFELSE([AC_LANG_PROGRAM([[
-+#include <stdio.h>
- #include <limits.h>
- #include "gmp.h"
--#include "gmp-impl.h"
- ]], [[
-- return GMP_NUMB_BITS == BYTES_PER_MP_LIMB * CHAR_BIT
-- && sizeof(mp_limb_t) == BYTES_PER_MP_LIMB ? 0 : 1;
-+ if (GMP_NUMB_BITS == sizeof(mp_limb_t) * CHAR_BIT)
-+ return 0;
-+ fprintf (stderr, "GMP_NUMB_BITS = %ld\n", (long) GMP_NUMB_BITS);
-+ fprintf (stderr, "sizeof(mp_limb_t) = %ld\n", (long) sizeof(mp_limb_t));
-+ fprintf (stderr, "sizeof(mp_limb_t) * CHAR_BIT = %ld != GMP_NUMB_BITS\n",
-+ (long) (sizeof(mp_limb_t) * CHAR_BIT));
-+ return 1;
- ]])], [AC_MSG_RESULT(yes)], [
- AC_MSG_RESULT(no)
-- AC_MSG_ERROR([GMP_NUMB_BITS is incorrect.
--You probably need to change some of the GMP or MPFR compile options.])],
-+ AC_MSG_ERROR([GMP_NUMB_BITS and sizeof(mp_limb_t) are not consistent.
-+You probably need to change some of the GMP or MPFR compile options.
-+See 'config.log' for details (search for GMP_NUMB_BITS).])],
- [AC_MSG_RESULT([can't test])])
--fi
-
-
- dnl We really need to link using libtool. But it is impossible with the current
-diff -Naurd mpfr-3.1.2-a/src/init2.c mpfr-3.1.2-b/src/init2.c
---- mpfr-3.1.2-a/src/init2.c 2013-03-13 15:37:32.000000000 +0000
-+++ mpfr-3.1.2-b/src/init2.c 2014-04-15 22:21:06.220398489 +0000
-@@ -30,11 +30,11 @@
-
- /* Check if we can represent the number of limbs
- * associated to the maximum of mpfr_prec_t*/
-- MPFR_ASSERTN( MP_SIZE_T_MAX >= (MPFR_PREC_MAX/BYTES_PER_MP_LIMB) );
-+ MPFR_ASSERTN( MP_SIZE_T_MAX >= (MPFR_PREC_MAX/MPFR_BYTES_PER_MP_LIMB) );
-
-- /* Check for correct GMP_NUMB_BITS and BYTES_PER_MP_LIMB */
-- MPFR_ASSERTN( GMP_NUMB_BITS == BYTES_PER_MP_LIMB * CHAR_BIT
-- && sizeof(mp_limb_t) == BYTES_PER_MP_LIMB );
-+ /* Check for correct GMP_NUMB_BITS and MPFR_BYTES_PER_MP_LIMB */
-+ MPFR_ASSERTN( GMP_NUMB_BITS == MPFR_BYTES_PER_MP_LIMB * CHAR_BIT
-+ && sizeof(mp_limb_t) == MPFR_BYTES_PER_MP_LIMB );
-
- MPFR_ASSERTN (mp_bits_per_limb == GMP_NUMB_BITS);
-
-diff -Naurd mpfr-3.1.2-a/src/mpfr-gmp.h mpfr-3.1.2-b/src/mpfr-gmp.h
---- mpfr-3.1.2-a/src/mpfr-gmp.h 2013-03-13 15:37:32.000000000 +0000
-+++ mpfr-3.1.2-b/src/mpfr-gmp.h 2014-04-15 22:21:06.220398489 +0000
-@@ -72,7 +72,6 @@
- #endif
-
- /* Define some macros */
--#define BYTES_PER_MP_LIMB (GMP_NUMB_BITS/CHAR_BIT)
-
- #define MP_LIMB_T_MAX (~(mp_limb_t)0)
-
-@@ -96,19 +95,19 @@
- #define SHRT_HIGHBIT SHRT_MIN
-
- /* MP_LIMB macros */
--#define MPN_ZERO(dst, n) memset((dst), 0, (n)*BYTES_PER_MP_LIMB)
--#define MPN_COPY_DECR(dst,src,n) memmove((dst),(src),(n)*BYTES_PER_MP_LIMB)
--#define MPN_COPY_INCR(dst,src,n) memmove((dst),(src),(n)*BYTES_PER_MP_LIMB)
-+#define MPN_ZERO(dst, n) memset((dst), 0, (n)*MPFR_BYTES_PER_MP_LIMB)
-+#define MPN_COPY_DECR(dst,src,n) memmove((dst),(src),(n)*MPFR_BYTES_PER_MP_LIMB)
-+#define MPN_COPY_INCR(dst,src,n) memmove((dst),(src),(n)*MPFR_BYTES_PER_MP_LIMB)
- #define MPN_COPY(dst,src,n) \
- do \
- { \
- if ((dst) != (src)) \
- { \
- MPFR_ASSERTD ((char *) (dst) >= (char *) (src) + \
-- (n) * BYTES_PER_MP_LIMB || \
-+ (n) * MPFR_BYTES_PER_MP_LIMB || \
- (char *) (src) >= (char *) (dst) + \
-- (n) * BYTES_PER_MP_LIMB); \
-- memcpy ((dst), (src), (n) * BYTES_PER_MP_LIMB); \
-+ (n) * MPFR_BYTES_PER_MP_LIMB); \
-+ memcpy ((dst), (src), (n) * MPFR_BYTES_PER_MP_LIMB); \
- } \
- } \
- while (0)
-diff -Naurd mpfr-3.1.2-a/src/mpfr-impl.h mpfr-3.1.2-b/src/mpfr-impl.h
---- mpfr-3.1.2-a/src/mpfr-impl.h 2013-10-09 13:34:21.000000000 +0000
-+++ mpfr-3.1.2-b/src/mpfr-impl.h 2014-04-15 22:21:06.220398489 +0000
-@@ -191,7 +191,7 @@
- # endif
- #endif
-
--
-+#define MPFR_BYTES_PER_MP_LIMB (GMP_NUMB_BITS/CHAR_BIT)
-
- /******************************************************
- ******************** Check GMP ***********************
-@@ -930,7 +930,7 @@
- #define MPFR_SET_ALLOC_SIZE(x, n) \
- ( ((mp_size_t*) MPFR_MANT(x))[-1] = n)
- #define MPFR_MALLOC_SIZE(s) \
-- ( sizeof(mpfr_size_limb_t) + BYTES_PER_MP_LIMB * ((size_t) s) )
-+ ( sizeof(mpfr_size_limb_t) + MPFR_BYTES_PER_MP_LIMB * ((size_t) s) )
- #define MPFR_SET_MANT_PTR(x,p) \
- (MPFR_MANT(x) = (mp_limb_t*) ((mpfr_size_limb_t*) p + 1))
- #define MPFR_GET_REAL_PTR(x) \
-@@ -964,7 +964,7 @@
- #endif
-
- #define MPFR_TMP_LIMBS_ALLOC(N) \
-- ((mp_limb_t *) MPFR_TMP_ALLOC ((size_t) (N) * BYTES_PER_MP_LIMB))
-+ ((mp_limb_t *) MPFR_TMP_ALLOC ((size_t) (N) * MPFR_BYTES_PER_MP_LIMB))
-
- /* temporary allocate 1 limb at xp, and initialize mpfr variable x */
- /* The temporary var doesn't have any size field, but it doesn't matter
-diff -Naurd mpfr-3.1.2-a/src/mpfr.h mpfr-3.1.2-b/src/mpfr.h
---- mpfr-3.1.2-a/src/mpfr.h 2014-04-15 22:20:20.755171478 +0000
-+++ mpfr-3.1.2-b/src/mpfr.h 2014-04-15 22:21:45.225450147 +0000
-@@ -27,7 +27,7 @@
- #define MPFR_VERSION_MAJOR 3
- #define MPFR_VERSION_MINOR 1
- #define MPFR_VERSION_PATCHLEVEL 2
--#define MPFR_VERSION_STRING "3.1.2-p7"
-+#define MPFR_VERSION_STRING "3.1.2-p8"
-
- /* Macros dealing with MPFR VERSION */
- #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
-diff -Naurd mpfr-3.1.2-a/src/mul.c mpfr-3.1.2-b/src/mul.c
---- mpfr-3.1.2-a/src/mul.c 2013-03-13 15:37:37.000000000 +0000
-+++ mpfr-3.1.2-b/src/mul.c 2014-04-15 22:21:06.224398597 +0000
-@@ -106,7 +106,7 @@
- MPFR_ASSERTD(tn <= k);
-
- /* Check for no size_t overflow*/
-- MPFR_ASSERTD((size_t) k <= ((size_t) -1) / BYTES_PER_MP_LIMB);
-+ MPFR_ASSERTD((size_t) k <= ((size_t) -1) / MPFR_BYTES_PER_MP_LIMB);
- MPFR_TMP_MARK(marker);
- tmp = MPFR_TMP_LIMBS_ALLOC (k);
-
-@@ -301,7 +301,7 @@
- MPFR_ASSERTD (tn <= k); /* tn <= k, thus no int overflow */
-
- /* Check for no size_t overflow*/
-- MPFR_ASSERTD ((size_t) k <= ((size_t) -1) / BYTES_PER_MP_LIMB);
-+ MPFR_ASSERTD ((size_t) k <= ((size_t) -1) / MPFR_BYTES_PER_MP_LIMB);
- MPFR_TMP_MARK (marker);
- tmp = MPFR_TMP_LIMBS_ALLOC (k);
-
-diff -Naurd mpfr-3.1.2-a/src/stack_interface.c mpfr-3.1.2-b/src/stack_interface.c
---- mpfr-3.1.2-a/src/stack_interface.c 2013-03-13 15:37:32.000000000 +0000
-+++ mpfr-3.1.2-b/src/stack_interface.c 2014-04-15 22:21:06.220398489 +0000
-@@ -26,7 +26,7 @@
- size_t
- mpfr_custom_get_size (mpfr_prec_t prec)
- {
-- return MPFR_PREC2LIMBS (prec) * BYTES_PER_MP_LIMB;
-+ return MPFR_PREC2LIMBS (prec) * MPFR_BYTES_PER_MP_LIMB;
- }
-
- #undef mpfr_custom_init
-diff -Naurd mpfr-3.1.2-a/src/version.c mpfr-3.1.2-b/src/version.c
---- mpfr-3.1.2-a/src/version.c 2014-04-15 22:20:20.755171478 +0000
-+++ mpfr-3.1.2-b/src/version.c 2014-04-15 22:21:45.225450147 +0000
-@@ -25,5 +25,5 @@
- const char *
- mpfr_get_version (void)
- {
-- return "3.1.2-p7";
-+ return "3.1.2-p8";
- }
-diff -Naurd mpfr-3.1.2-a/PATCHES mpfr-3.1.2-b/PATCHES
---- mpfr-3.1.2-a/PATCHES 2014-06-30 15:15:25.533266905 +0000
-+++ mpfr-3.1.2-b/PATCHES 2014-06-30 15:15:25.617269178 +0000
-@@ -0,0 +1 @@
-+div-overflow
-diff -Naurd mpfr-3.1.2-a/VERSION mpfr-3.1.2-b/VERSION
---- mpfr-3.1.2-a/VERSION 2014-06-30 15:15:25.529266797 +0000
-+++ mpfr-3.1.2-b/VERSION 2014-06-30 15:15:25.617269178 +0000
-@@ -1 +1 @@
--3.1.2-p8
-+3.1.2-p9
-diff -Naurd mpfr-3.1.2-a/src/div.c mpfr-3.1.2-b/src/div.c
---- mpfr-3.1.2-a/src/div.c 2013-03-13 15:37:33.000000000 +0000
-+++ mpfr-3.1.2-b/src/div.c 2014-06-30 15:15:25.585268312 +0000
-@@ -750,7 +750,9 @@
- truncate_check_qh:
- if (qh)
- {
-- qexp ++;
-+ if (MPFR_LIKELY (qexp < MPFR_EXP_MAX))
-+ qexp ++;
-+ /* else qexp is now incorrect, but one will still get an overflow */
- q0p[q0size - 1] = MPFR_LIMB_HIGHBIT;
- }
- goto truncate;
-@@ -765,7 +767,9 @@
- inex = 1; /* always here */
- if (mpn_add_1 (q0p, q0p, q0size, MPFR_LIMB_ONE << sh))
- {
-- qexp ++;
-+ if (MPFR_LIKELY (qexp < MPFR_EXP_MAX))
-+ qexp ++;
-+ /* else qexp is now incorrect, but one will still get an overflow */
- q0p[q0size - 1] = MPFR_LIMB_HIGHBIT;
- }
-
-diff -Naurd mpfr-3.1.2-a/src/mpfr.h mpfr-3.1.2-b/src/mpfr.h
---- mpfr-3.1.2-a/src/mpfr.h 2014-06-30 15:15:25.533266905 +0000
-+++ mpfr-3.1.2-b/src/mpfr.h 2014-06-30 15:15:25.613269070 +0000
-@@ -27,7 +27,7 @@
- #define MPFR_VERSION_MAJOR 3
- #define MPFR_VERSION_MINOR 1
- #define MPFR_VERSION_PATCHLEVEL 2
--#define MPFR_VERSION_STRING "3.1.2-p8"
-+#define MPFR_VERSION_STRING "3.1.2-p9"
-
- /* Macros dealing with MPFR VERSION */
- #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
-diff -Naurd mpfr-3.1.2-a/src/version.c mpfr-3.1.2-b/src/version.c
---- mpfr-3.1.2-a/src/version.c 2014-06-30 15:15:25.533266905 +0000
-+++ mpfr-3.1.2-b/src/version.c 2014-06-30 15:15:25.613269070 +0000
-@@ -25,5 +25,5 @@
- const char *
- mpfr_get_version (void)
- {
-- return "3.1.2-p8";
-+ return "3.1.2-p9";
- }
-diff -Naurd mpfr-3.1.2-a/tests/tdiv.c mpfr-3.1.2-b/tests/tdiv.c
---- mpfr-3.1.2-a/tests/tdiv.c 2013-03-13 15:37:44.000000000 +0000
-+++ mpfr-3.1.2-b/tests/tdiv.c 2014-06-30 15:15:25.585268312 +0000
-@@ -1104,6 +1104,96 @@
- #define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), randlimb () % 100, RANDS)
- #include "tgeneric.c"
-
-+static void
-+test_extreme (void)
-+{
-+ mpfr_t x, y, z;
-+ mpfr_exp_t emin, emax;
-+ mpfr_prec_t p[4] = { 8, 32, 64, 256 };
-+ int xi, yi, zi, j, r;
-+ unsigned int flags, ex_flags;
-+
-+ emin = mpfr_get_emin ();
-+ emax = mpfr_get_emax ();
-+
-+ mpfr_set_emin (MPFR_EMIN_MIN);
-+ mpfr_set_emax (MPFR_EMAX_MAX);
-+
-+ for (xi = 0; xi < 4; xi++)
-+ {
-+ mpfr_init2 (x, p[xi]);
-+ mpfr_setmax (x, MPFR_EMAX_MAX);
-+ MPFR_ASSERTN (mpfr_check (x));
-+ for (yi = 0; yi < 4; yi++)
-+ {
-+ mpfr_init2 (y, p[yi]);
-+ mpfr_setmin (y, MPFR_EMIN_MIN);
-+ for (j = 0; j < 2; j++)
-+ {
-+ MPFR_ASSERTN (mpfr_check (y));
-+ for (zi = 0; zi < 4; zi++)
-+ {
-+ mpfr_init2 (z, p[zi]);
-+ RND_LOOP (r)
-+ {
-+ mpfr_clear_flags ();
-+ mpfr_div (z, x, y, (mpfr_rnd_t) r);
-+ flags = __gmpfr_flags;
-+ MPFR_ASSERTN (mpfr_check (z));
-+ ex_flags = MPFR_FLAGS_OVERFLOW | MPFR_FLAGS_INEXACT;
-+ if (flags != ex_flags)
-+ {
-+ printf ("Bad flags in test_extreme on z = a/b"
-+ " with %s and\n",
-+ mpfr_print_rnd_mode ((mpfr_rnd_t) r));
-+ printf ("a = ");
-+ mpfr_dump (x);
-+ printf ("b = ");
-+ mpfr_dump (y);
-+ printf ("Expected flags:");
-+ flags_out (ex_flags);
-+ printf ("Got flags: ");
-+ flags_out (flags);
-+ printf ("z = ");
-+ mpfr_dump (z);
-+ exit (1);
-+ }
-+ mpfr_clear_flags ();
-+ mpfr_div (z, y, x, (mpfr_rnd_t) r);
-+ flags = __gmpfr_flags;
-+ MPFR_ASSERTN (mpfr_check (z));
-+ ex_flags = MPFR_FLAGS_UNDERFLOW | MPFR_FLAGS_INEXACT;
-+ if (flags != ex_flags)
-+ {
-+ printf ("Bad flags in test_extreme on z = a/b"
-+ " with %s and\n",
-+ mpfr_print_rnd_mode ((mpfr_rnd_t) r));
-+ printf ("a = ");
-+ mpfr_dump (y);
-+ printf ("b = ");
-+ mpfr_dump (x);
-+ printf ("Expected flags:");
-+ flags_out (ex_flags);
-+ printf ("Got flags: ");
-+ flags_out (flags);
-+ printf ("z = ");
-+ mpfr_dump (z);
-+ exit (1);
-+ }
-+ }
-+ mpfr_clear (z);
-+ } /* zi */
-+ mpfr_nextabove (y);
-+ } /* j */
-+ mpfr_clear (y);
-+ } /* yi */
-+ mpfr_clear (x);
-+ } /* xi */
-+
-+ set_emin (emin);
-+ set_emax (emax);
-+}
-+
- int
- main (int argc, char *argv[])
- {
-@@ -1130,6 +1220,7 @@
- test_20070603 ();
- test_20070628 ();
- test_generic (2, 800, 50);
-+ test_extreme ();
-
- tests_end_mpfr ();
- return 0;
-diff -Naurd mpfr-3.1.2-a/PATCHES mpfr-3.1.2-b/PATCHES
---- mpfr-3.1.2-a/PATCHES 2014-06-30 15:17:53.337268149 +0000
-+++ mpfr-3.1.2-b/PATCHES 2014-06-30 15:17:53.417270314 +0000
-@@ -0,0 +1 @@
-+vasprintf
-diff -Naurd mpfr-3.1.2-a/VERSION mpfr-3.1.2-b/VERSION
---- mpfr-3.1.2-a/VERSION 2014-06-30 15:17:53.337268149 +0000
-+++ mpfr-3.1.2-b/VERSION 2014-06-30 15:17:53.413270206 +0000
-@@ -1 +1 @@
--3.1.2-p9
-+3.1.2-p10
-diff -Naurd mpfr-3.1.2-a/src/mpfr.h mpfr-3.1.2-b/src/mpfr.h
---- mpfr-3.1.2-a/src/mpfr.h 2014-06-30 15:17:53.337268149 +0000
-+++ mpfr-3.1.2-b/src/mpfr.h 2014-06-30 15:17:53.413270206 +0000
-@@ -27,7 +27,7 @@
- #define MPFR_VERSION_MAJOR 3
- #define MPFR_VERSION_MINOR 1
- #define MPFR_VERSION_PATCHLEVEL 2
--#define MPFR_VERSION_STRING "3.1.2-p9"
-+#define MPFR_VERSION_STRING "3.1.2-p10"
-
- /* Macros dealing with MPFR VERSION */
- #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
-diff -Naurd mpfr-3.1.2-a/src/vasprintf.c mpfr-3.1.2-b/src/vasprintf.c
---- mpfr-3.1.2-a/src/vasprintf.c 2013-11-15 00:51:49.267334408 +0000
-+++ mpfr-3.1.2-b/src/vasprintf.c 2014-06-30 15:17:53.377269231 +0000
-@@ -884,14 +884,18 @@
- first digit, we want the exponent for radix two and the decimal
- point AFTER the first digit. */
- {
-- MPFR_ASSERTN (exp > MPFR_EMIN_MIN /4); /* possible overflow */
-+ /* An integer overflow is normally not possible since MPFR_EXP_MIN
-+ is twice as large as MPFR_EMIN_MIN. */
-+ MPFR_ASSERTN (exp > (MPFR_EXP_MIN + 3) / 4);
- exp = (exp - 1) * 4;
- }
- else
- /* EXP is the exponent for decimal point BEFORE the first digit, we
- want the exponent for decimal point AFTER the first digit. */
- {
-- MPFR_ASSERTN (exp > MPFR_EMIN_MIN); /* possible overflow */
-+ /* An integer overflow is normally not possible since MPFR_EXP_MIN
-+ is twice as large as MPFR_EMIN_MIN. */
-+ MPFR_ASSERTN (exp > MPFR_EXP_MIN);
- --exp;
- }
- }
-diff -Naurd mpfr-3.1.2-a/src/version.c mpfr-3.1.2-b/src/version.c
---- mpfr-3.1.2-a/src/version.c 2014-06-30 15:17:53.337268149 +0000
-+++ mpfr-3.1.2-b/src/version.c 2014-06-30 15:17:53.413270206 +0000
-@@ -25,5 +25,5 @@
- const char *
- mpfr_get_version (void)
- {
-- return "3.1.2-p9";
-+ return "3.1.2-p10";
- }
-diff -Naurd mpfr-3.1.2-a/tests/tsprintf.c mpfr-3.1.2-b/tests/tsprintf.c
---- mpfr-3.1.2-a/tests/tsprintf.c 2013-11-15 00:51:49.267334408 +0000
-+++ mpfr-3.1.2-b/tests/tsprintf.c 2014-06-30 15:17:53.377269231 +0000
-@@ -1184,6 +1184,69 @@
- check_emax_aux (MPFR_EMAX_MAX);
- }
-
-+static void
-+check_emin_aux (mpfr_exp_t e)
-+{
-+ mpfr_t x;
-+ char *s1, s2[256];
-+ int i;
-+ mpfr_exp_t emin;
-+ mpz_t ee;
-+
-+ MPFR_ASSERTN (e >= LONG_MIN);
-+ emin = mpfr_get_emin ();
-+ set_emin (e);
-+
-+ mpfr_init2 (x, 16);
-+ mpz_init (ee);
-+
-+ mpfr_setmin (x, e);
-+ mpz_set_si (ee, e);
-+ mpz_sub_ui (ee, ee, 1);
-+
-+ i = mpfr_asprintf (&s1, "%Ra", x);
-+ MPFR_ASSERTN (i > 0);
-+
-+ gmp_snprintf (s2, 256, "0x1p%Zd", ee);
-+
-+ if (strcmp (s1, s2) != 0)
-+ {
-+ printf ("Error in check_emin_aux for emin = %ld\n", (long) e);
-+ printf ("Expected %s\n", s2);
-+ printf ("Got %s\n", s1);
-+ exit (1);
-+ }
-+
-+ mpfr_free_str (s1);
-+
-+ i = mpfr_asprintf (&s1, "%Rb", x);
-+ MPFR_ASSERTN (i > 0);
-+
-+ gmp_snprintf (s2, 256, "1p%Zd", ee);
-+
-+ if (strcmp (s1, s2) != 0)
-+ {
-+ printf ("Error in check_emin_aux for emin = %ld\n", (long) e);
-+ printf ("Expected %s\n", s2);
-+ printf ("Got %s\n", s1);
-+ exit (1);
-+ }
-+
-+ mpfr_free_str (s1);
-+
-+ mpfr_clear (x);
-+ mpz_clear (ee);
-+ set_emin (emin);
-+}
-+
-+static void
-+check_emin (void)
-+{
-+ check_emin_aux (-15);
-+ check_emin_aux (mpfr_get_emin ());
-+ check_emin_aux (MPFR_EMIN_MIN);
-+}
-+
- int
- main (int argc, char **argv)
- {
-@@ -1203,6 +1266,7 @@
- decimal ();
- mixed ();
- check_emax ();
-+ check_emin ();
-
- #if defined(HAVE_LOCALE_H) && defined(HAVE_SETLOCALE)
- locale_da_DK ();
-diff -Naurd mpfr-3.1.2-a/PATCHES mpfr-3.1.2-b/PATCHES
---- mpfr-3.1.2-a/PATCHES 2014-12-04 01:41:57.131789485 +0000
-+++ mpfr-3.1.2-b/PATCHES 2014-12-04 01:41:57.339791833 +0000
-@@ -0,0 +1 @@
-+strtofr
-diff -Naurd mpfr-3.1.2-a/VERSION mpfr-3.1.2-b/VERSION
---- mpfr-3.1.2-a/VERSION 2014-12-04 01:41:57.127789443 +0000
-+++ mpfr-3.1.2-b/VERSION 2014-12-04 01:41:57.339791833 +0000
-@@ -1 +1 @@
--3.1.2-p10
-+3.1.2-p11
-diff -Naurd mpfr-3.1.2-a/src/mpfr.h mpfr-3.1.2-b/src/mpfr.h
---- mpfr-3.1.2-a/src/mpfr.h 2014-12-04 01:41:57.127789443 +0000
-+++ mpfr-3.1.2-b/src/mpfr.h 2014-12-04 01:41:57.335791790 +0000
-@@ -27,7 +27,7 @@
- #define MPFR_VERSION_MAJOR 3
- #define MPFR_VERSION_MINOR 1
- #define MPFR_VERSION_PATCHLEVEL 2
--#define MPFR_VERSION_STRING "3.1.2-p10"
-+#define MPFR_VERSION_STRING "3.1.2-p11"
-
- /* Macros dealing with MPFR VERSION */
- #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
-diff -Naurd mpfr-3.1.2-a/src/strtofr.c mpfr-3.1.2-b/src/strtofr.c
---- mpfr-3.1.2-a/src/strtofr.c 2013-03-13 15:37:32.000000000 +0000
-+++ mpfr-3.1.2-b/src/strtofr.c 2014-12-04 01:41:57.287791246 +0000
-@@ -473,8 +473,10 @@
- /* prec bits corresponds to ysize limbs */
- ysize_bits = ysize * GMP_NUMB_BITS;
- /* and to ysize_bits >= prec > MPFR_PREC (x) bits */
-- y = MPFR_TMP_LIMBS_ALLOC (2 * ysize + 1);
-- y += ysize; /* y has (ysize+1) allocated limbs */
-+ /* we need to allocate one more limb to work around bug
-+ https://gmplib.org/list-archives/gmp-bugs/2013-December/003267.html */
-+ y = MPFR_TMP_LIMBS_ALLOC (2 * ysize + 2);
-+ y += ysize; /* y has (ysize+2) allocated limbs */
-
- /* pstr_size is the number of characters we read in pstr->mant
- to have at least ysize full limbs.
-diff -Naurd mpfr-3.1.2-a/src/version.c mpfr-3.1.2-b/src/version.c
---- mpfr-3.1.2-a/src/version.c 2014-12-04 01:41:57.131789485 +0000
-+++ mpfr-3.1.2-b/src/version.c 2014-12-04 01:41:57.339791833 +0000
-@@ -25,5 +25,5 @@
- const char *
- mpfr_get_version (void)
- {
-- return "3.1.2-p10";
-+ return "3.1.2-p11";
- }
diff --git a/libre/mpfr-static/mpfr-3.1.3-p5.patch b/libre/mpfr-static/mpfr-3.1.3-p5.patch
deleted file mode 100644
index 891831f52..000000000
--- a/libre/mpfr-static/mpfr-3.1.3-p5.patch
+++ /dev/null
@@ -1,1830 +0,0 @@
-diff -Naurd mpfr-3.1.3-a/PATCHES mpfr-3.1.3-b/PATCHES
---- mpfr-3.1.3-a/PATCHES 2015-07-02 10:49:23.950112879 +0000
-+++ mpfr-3.1.3-b/PATCHES 2015-07-02 10:49:24.042113845 +0000
-@@ -0,0 +1 @@
-+lngamma-and-doc
-diff -Naurd mpfr-3.1.3-a/VERSION mpfr-3.1.3-b/VERSION
---- mpfr-3.1.3-a/VERSION 2015-06-19 19:55:09.000000000 +0000
-+++ mpfr-3.1.3-b/VERSION 2015-07-02 10:49:24.042113845 +0000
-@@ -1 +1 @@
--3.1.3
-+3.1.3-p1
-diff -Naurd mpfr-3.1.3-a/doc/mpfr.texi mpfr-3.1.3-b/doc/mpfr.texi
---- mpfr-3.1.3-a/doc/mpfr.texi 2015-06-19 19:55:11.000000000 +0000
-+++ mpfr-3.1.3-b/doc/mpfr.texi 2015-07-02 10:49:24.018113593 +0000
-@@ -810,13 +810,17 @@
- When the input point is in the closure of the domain of the mathematical
- function and an input argument is +0 (resp.@: @minus{}0), one considers
- the limit when the corresponding argument approaches 0 from above
--(resp.@: below). If the limit is not defined (e.g., @code{mpfr_log} on
--@minus{}0), the behavior is specified in the description of the MPFR function.
-+(resp.@: below), if possible. If the limit is not defined (e.g.,
-+@code{mpfr_sqrt} and @code{mpfr_log} on @minus{}0), the behavior is
-+specified in the description of the MPFR function, but must be consistent
-+with the rule from the above paragraph (e.g., @code{mpfr_log} on @pom{}0
-+gives @minus{}Inf).
-
- When the result is equal to 0, its sign is determined by considering the
- limit as if the input point were not in the domain: If one approaches 0
- from above (resp.@: below), the result is +0 (resp.@: @minus{}0);
--for example, @code{mpfr_sin} on +0 gives +0.
-+for example, @code{mpfr_sin} on @minus{}0 gives @minus{}0 and
-+@code{mpfr_acos} on 1 gives +0 (in all rounding modes).
- In the other cases, the sign is specified in the description of the MPFR
- function; for example @code{mpfr_max} on @minus{}0 and +0 gives +0.
-
-@@ -832,8 +836,8 @@
- @c that advantages in practice), like for any bug fix.
- Example: @code{mpfr_hypot} on (NaN,0) gives NaN, but @code{mpfr_hypot}
- on (NaN,+Inf) gives +Inf (as specified in @ref{Special Functions}),
--since for any finite input @var{x}, @code{mpfr_hypot} on (@var{x},+Inf)
--gives +Inf.
-+since for any finite or infinite input @var{x}, @code{mpfr_hypot} on
-+(@var{x},+Inf) gives +Inf.
-
- @node Exceptions, Memory Handling, Floating-Point Values on Special Numbers, MPFR Basics
- @comment node-name, next, previous, up
-@@ -1581,7 +1585,8 @@
- @deftypefunx int mpfr_add_z (mpfr_t @var{rop}, mpfr_t @var{op1}, mpz_t @var{op2}, mpfr_rnd_t @var{rnd})
- @deftypefunx int mpfr_add_q (mpfr_t @var{rop}, mpfr_t @var{op1}, mpq_t @var{op2}, mpfr_rnd_t @var{rnd})
- Set @var{rop} to @math{@var{op1} + @var{op2}} rounded in the direction
--@var{rnd}. For types having no signed zero, it is considered unsigned
-+@var{rnd}. The IEEE-754 rules are used, in particular for signed zeros.
-+But for types having no signed zeros, 0 is considered unsigned
- (i.e., (+0) + 0 = (+0) and (@minus{}0) + 0 = (@minus{}0)).
- The @code{mpfr_add_d} function assumes that the radix of the @code{double} type
- is a power of 2, with a precision at most that declared by the C implementation
-@@ -1599,7 +1604,8 @@
- @deftypefunx int mpfr_sub_z (mpfr_t @var{rop}, mpfr_t @var{op1}, mpz_t @var{op2}, mpfr_rnd_t @var{rnd})
- @deftypefunx int mpfr_sub_q (mpfr_t @var{rop}, mpfr_t @var{op1}, mpq_t @var{op2}, mpfr_rnd_t @var{rnd})
- Set @var{rop} to @math{@var{op1} - @var{op2}} rounded in the direction
--@var{rnd}. For types having no signed zero, it is considered unsigned
-+@var{rnd}. The IEEE-754 rules are used, in particular for signed zeros.
-+But for types having no signed zeros, 0 is considered unsigned
- (i.e., (+0) @minus{} 0 = (+0), (@minus{}0) @minus{} 0 = (@minus{}0),
- 0 @minus{} (+0) = (@minus{}0) and 0 @minus{} (@minus{}0) = (+0)).
- The same restrictions than for @code{mpfr_add_d} apply to @code{mpfr_d_sub}
-@@ -1615,7 +1621,7 @@
- Set @var{rop} to @math{@var{op1} @GMPtimes{} @var{op2}} rounded in the
- direction @var{rnd}.
- When a result is zero, its sign is the product of the signs of the operands
--(for types having no signed zero, it is considered positive).
-+(for types having no signed zeros, 0 is considered positive).
- The same restrictions than for @code{mpfr_add_d} apply to @code{mpfr_mul_d}.
- @end deftypefun
-
-@@ -1635,7 +1641,7 @@
- @deftypefunx int mpfr_div_q (mpfr_t @var{rop}, mpfr_t @var{op1}, mpq_t @var{op2}, mpfr_rnd_t @var{rnd})
- Set @var{rop} to @math{@var{op1}/@var{op2}} rounded in the direction @var{rnd}.
- When a result is zero, its sign is the product of the signs of the operands
--(for types having no signed zero, it is considered positive).
-+(for types having no signed zeros, 0 is considered positive).
- The same restrictions than for @code{mpfr_add_d} apply to @code{mpfr_d_div}
- and @code{mpfr_div_d}.
- @end deftypefun
-@@ -1643,15 +1649,18 @@
- @deftypefun int mpfr_sqrt (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
- @deftypefunx int mpfr_sqrt_ui (mpfr_t @var{rop}, unsigned long int @var{op}, mpfr_rnd_t @var{rnd})
- Set @var{rop} to @m{\sqrt{@var{op}}, the square root of @var{op}}
--rounded in the direction @var{rnd} (set @var{rop} to @minus{}0 if @var{op} is
--@minus{}0, to be consistent with the IEEE 754 standard).
-+rounded in the direction @var{rnd}. Set @var{rop} to @minus{}0 if
-+@var{op} is @minus{}0, to be consistent with the IEEE 754 standard.
- Set @var{rop} to NaN if @var{op} is negative.
- @end deftypefun
-
- @deftypefun int mpfr_rec_sqrt (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
- Set @var{rop} to @m{1/\sqrt{@var{op}}, the reciprocal square root of @var{op}}
--rounded in the direction @var{rnd}. Set @var{rop} to +Inf if @var{op} is
--@pom{}0, +0 if @var{op} is +Inf, and NaN if @var{op} is negative.
-+rounded in the direction @var{rnd}. Set @var{rop} to +Inf if @var{op} is
-+@pom{}0, +0 if @var{op} is +Inf, and NaN if @var{op} is negative. Warning!
-+Therefore the result on @minus{}0 is different from the one of the rSqrt
-+function recommended by the IEEE 754-2008 standard (Section 9.2.1), which
-+is @minus{}Inf instead of +Inf.
- @end deftypefun
-
- @deftypefun int mpfr_cbrt (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
-@@ -1832,7 +1841,9 @@
- @m{\log_2 @var{op}, log2(@var{op})} or
- @m{\log_{10} @var{op}, log10(@var{op})}, respectively,
- rounded in the direction @var{rnd}.
--Set @var{rop} to @minus{}Inf if @var{op} is @minus{}0
-+Set @var{rop} to +0 if @var{op} is 1 (in all rounding modes),
-+for consistency with the ISO C99 and IEEE 754-2008 standards.
-+Set @var{rop} to @minus{}Inf if @var{op} is @pom{}0
- (i.e., the sign of the zero has no influence on the result).
- @end deftypefun
-
-@@ -2003,8 +2014,11 @@
- @deftypefun int mpfr_lngamma (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
- Set @var{rop} to the value of the logarithm of the Gamma function on @var{op},
- rounded in the direction @var{rnd}.
--When @math{@minus{}2@var{k}@minus{}1 @le{} @var{op} @le{} @minus{}2@var{k}},
--@var{k} being a non-negative integer, @var{rop} is set to NaN.
-+When @var{op} is 1 or 2, set @var{rop} to +0 (in all rounding modes).
-+When @var{op} is an infinity or a nonpositive integer, set @var{rop} to +Inf,
-+following the general rules on special values.
-+When @math{@minus{}2@var{k}@minus{}1 < @var{op} < @minus{}2@var{k}},
-+@var{k} being a nonnegative integer, set @var{rop} to NaN@.
- See also @code{mpfr_lgamma}.
- @end deftypefun
-
-@@ -2012,10 +2026,11 @@
- Set @var{rop} to the value of the logarithm of the absolute value of the
- Gamma function on @var{op}, rounded in the direction @var{rnd}. The sign
- (1 or @minus{}1) of Gamma(@var{op}) is returned in the object pointed to
--by @var{signp}. When @var{op} is an infinity or a non-positive integer, set
--@var{rop} to +Inf. When @var{op} is NaN, @minus{}Inf or a negative integer,
--*@var{signp} is undefined, and when @var{op} is @pom{}0, *@var{signp} is
--the sign of the zero.
-+by @var{signp}.
-+When @var{op} is 1 or 2, set @var{rop} to +0 (in all rounding modes).
-+When @var{op} is an infinity or a nonpositive integer, set @var{rop} to +Inf.
-+When @var{op} is NaN, @minus{}Inf or a negative integer, *@var{signp} is
-+undefined, and when @var{op} is @pom{}0, *@var{signp} is the sign of the zero.
- @end deftypefun
-
- @deftypefun int mpfr_digamma (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
-@@ -2064,7 +2079,10 @@
- @deftypefunx int mpfr_fms (mpfr_t @var{rop}, mpfr_t @var{op1}, mpfr_t @var{op2}, mpfr_t @var{op3}, mpfr_rnd_t @var{rnd})
- Set @var{rop} to @math{(@var{op1} @GMPtimes{} @var{op2}) + @var{op3}}
- (resp.@: @math{(@var{op1} @GMPtimes{} @var{op2}) - @var{op3}})
--rounded in the direction @var{rnd}.
-+rounded in the direction @var{rnd}. Concerning special values (signed zeros,
-+infinities, NaN), these functions behave like a multiplication followed by a
-+separate addition or subtraction. That is, the fused operation matters only
-+for rounding.
- @end deftypefun
-
- @deftypefun int mpfr_agm (mpfr_t @var{rop}, mpfr_t @var{op1}, mpfr_t @var{op2}, mpfr_rnd_t @var{rnd})
-@@ -2089,8 +2107,8 @@
- i.e., $\sqrt{x^2+y^2}$,
- @end tex
- rounded in the direction @var{rnd}.
--Special values are handled as described in Section F.9.4.3 of
--the ISO C99 and IEEE 754-2008 standards:
-+Special values are handled as described in the ISO C99 (Section F.9.4.3)
-+and IEEE 754-2008 (Section 9.2.1) standards:
- If @var{x} or @var{y} is an infinity, then +Inf is returned in @var{rop},
- even if the other number is NaN.
- @end deftypefun
-diff -Naurd mpfr-3.1.3-a/doc/mpfr.info mpfr-3.1.3-b/doc/mpfr.info
---- mpfr-3.1.3-a/doc/mpfr.info 2015-06-19 19:55:53.000000000 +0000
-+++ mpfr-3.1.3-b/doc/mpfr.info 2015-07-02 10:49:38.718267817 +0000
-@@ -1,4 +1,4 @@
--This is mpfr.info, produced by makeinfo version 5.2 from mpfr.texi.
-+This is mpfr.info, produced by makeinfo version 6.0 from mpfr.texi.
-
- This manual documents how to install and use the Multiple Precision
- Floating-Point Reliable Library, version 3.1.3.
-@@ -55,7 +55,7 @@
- MPFR Copying Conditions
- ***********************
-
--The GNU MPFR library (or MPFR for short) is "free"; this means that
-+The GNU MPFR library (or MPFR for short) is “free”; this means that
- everyone is free to use it and free to redistribute it on a free basis.
- The library is not in the public domain; it is copyrighted and there are
- restrictions on its distribution, but these restrictions are designed to
-@@ -418,7 +418,7 @@
- 4.2 Nomenclature and Types
- ==========================
-
--A "floating-point number", or "float" for short, is an arbitrary
-+A “floating-point number”, or “float” for short, is an arbitrary
- precision significand (also called mantissa) with a limited precision
- exponent. The C data type for such objects is ‘mpfr_t’ (internally
- defined as a one-element array of a structure, and ‘mpfr_ptr’ is the C
-@@ -432,7 +432,7 @@
- to the other functions supported by MPFR. Unless documented otherwise,
- the sign bit of a NaN is unspecified.
-
--The "precision" is the number of bits used to represent the significand
-+The “precision” is the number of bits used to represent the significand
- of a floating-point number; the corresponding C data type is
- ‘mpfr_prec_t’. The precision can be any integer between ‘MPFR_PREC_MIN’
- and ‘MPFR_PREC_MAX’. In the current implementation, ‘MPFR_PREC_MIN’ is
-@@ -446,7 +446,7 @@
- may abort, crash or have undefined behavior (depending on your C
- implementation).
-
--The "rounding mode" specifies the way to round the result of a
-+The “rounding mode” specifies the way to round the result of a
- floating-point operation, in case the exact result can not be
- represented exactly in the destination significand; the corresponding C
- data type is ‘mpfr_rnd_t’.
-@@ -499,14 +499,14 @@
- representable numbers, it is rounded to the one with the least
- significant bit set to zero. For example, the number 2.5, which is
- represented by (10.1) in binary, is rounded to (10.0)=2 with a precision
--of two bits, and not to (11.0)=3. This rule avoids the "drift"
-+of two bits, and not to (11.0)=3. This rule avoids the “drift”
- phenomenon mentioned by Knuth in volume 2 of The Art of Computer
- Programming (Section 4.2.2).
-
- Most MPFR functions take as first argument the destination variable,
- as second and following arguments the input variables, as last argument
- a rounding mode, and have a return value of type ‘int’, called the
--"ternary value". The value stored in the destination variable is
-+“ternary value”. The value stored in the destination variable is
- correctly rounded, i.e., MPFR behaves as if it computed the result with
- an infinite precision, then rounded it to the precision of this
- variable. The input variables are regarded as exact (in particular,
-@@ -572,15 +572,18 @@
- When the input point is in the closure of the domain of the
- mathematical function and an input argument is +0 (resp. −0), one
- considers the limit when the corresponding argument approaches 0 from
--above (resp. below). If the limit is not defined (e.g., ‘mpfr_log’ on
--−0), the behavior is specified in the description of the MPFR function.
-+above (resp. below), if possible. If the limit is not defined (e.g.,
-+‘mpfr_sqrt’ and ‘mpfr_log’ on −0), the behavior is specified in the
-+description of the MPFR function, but must be consistent with the rule
-+from the above paragraph (e.g., ‘mpfr_log’ on ±0 gives −Inf).
-
- When the result is equal to 0, its sign is determined by considering
- the limit as if the input point were not in the domain: If one
- approaches 0 from above (resp. below), the result is +0 (resp. −0); for
--example, ‘mpfr_sin’ on +0 gives +0. In the other cases, the sign is
--specified in the description of the MPFR function; for example
--‘mpfr_max’ on −0 and +0 gives +0.
-+example, ‘mpfr_sin’ on −0 gives −0 and ‘mpfr_acos’ on 1 gives +0 (in all
-+rounding modes). In the other cases, the sign is specified in the
-+description of the MPFR function; for example ‘mpfr_max’ on −0 and +0
-+gives +0.
-
- When the input point is not in the closure of the domain of the
- function, the result is NaN. Example: ‘mpfr_sqrt’ on −17 gives NaN.
-@@ -590,8 +593,8 @@
- numbers; such a case is always explicitly specified in *note MPFR
- Interface::. Example: ‘mpfr_hypot’ on (NaN,0) gives NaN, but
- ‘mpfr_hypot’ on (NaN,+Inf) gives +Inf (as specified in *note Special
--Functions::), since for any finite input X, ‘mpfr_hypot’ on (X,+Inf)
--gives +Inf.
-+Functions::), since for any finite or infinite input X, ‘mpfr_hypot’ on
-+(X,+Inf) gives +Inf.
-
- 
- File: mpfr.info, Node: Exceptions, Next: Memory Handling, Prev: Floating-Point Values on Special Numbers, Up: MPFR Basics
-@@ -1253,8 +1256,9 @@
- mpfr_rnd_t RND)
- -- Function: int mpfr_add_q (mpfr_t ROP, mpfr_t OP1, mpq_t OP2,
- mpfr_rnd_t RND)
-- Set ROP to OP1 + OP2 rounded in the direction RND. For types
-- having no signed zero, it is considered unsigned (i.e., (+0) + 0 =
-+ Set ROP to OP1 + OP2 rounded in the direction RND. The IEEE-754
-+ rules are used, in particular for signed zeros. But for types
-+ having no signed zeros, 0 is considered unsigned (i.e., (+0) + 0 =
- (+0) and (−0) + 0 = (−0)). The ‘mpfr_add_d’ function assumes that
- the radix of the ‘double’ type is a power of 2, with a precision at
- most that declared by the C implementation (macro
-@@ -1280,8 +1284,9 @@
- mpfr_rnd_t RND)
- -- Function: int mpfr_sub_q (mpfr_t ROP, mpfr_t OP1, mpq_t OP2,
- mpfr_rnd_t RND)
-- Set ROP to OP1 - OP2 rounded in the direction RND. For types
-- having no signed zero, it is considered unsigned (i.e., (+0) − 0 =
-+ Set ROP to OP1 - OP2 rounded in the direction RND. The IEEE-754
-+ rules are used, in particular for signed zeros. But for types
-+ having no signed zeros, 0 is considered unsigned (i.e., (+0) − 0 =
- (+0), (−0) − 0 = (−0), 0 − (+0) = (−0) and 0 − (−0) = (+0)). The
- same restrictions than for ‘mpfr_add_d’ apply to ‘mpfr_d_sub’ and
- ‘mpfr_sub_d’.
-@@ -1300,7 +1305,7 @@
- mpfr_rnd_t RND)
- Set ROP to OP1 times OP2 rounded in the direction RND. When a
- result is zero, its sign is the product of the signs of the
-- operands (for types having no signed zero, it is considered
-+ operands (for types having no signed zeros, 0 is considered
- positive). The same restrictions than for ‘mpfr_add_d’ apply to
- ‘mpfr_mul_d’.
-
-@@ -1327,21 +1332,24 @@
- mpfr_rnd_t RND)
- Set ROP to OP1/OP2 rounded in the direction RND. When a result is
- zero, its sign is the product of the signs of the operands (for
-- types having no signed zero, it is considered positive). The same
-+ types having no signed zeros, 0 is considered positive). The same
- restrictions than for ‘mpfr_add_d’ apply to ‘mpfr_d_div’ and
- ‘mpfr_div_d’.
-
- -- Function: int mpfr_sqrt (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
- -- Function: int mpfr_sqrt_ui (mpfr_t ROP, unsigned long int OP,
- mpfr_rnd_t RND)
-- Set ROP to the square root of OP rounded in the direction RND (set
-- ROP to −0 if OP is −0, to be consistent with the IEEE 754
-- standard). Set ROP to NaN if OP is negative.
-+ Set ROP to the square root of OP rounded in the direction RND. Set
-+ ROP to −0 if OP is −0, to be consistent with the IEEE 754 standard.
-+ Set ROP to NaN if OP is negative.
-
- -- Function: int mpfr_rec_sqrt (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
- Set ROP to the reciprocal square root of OP rounded in the
- direction RND. Set ROP to +Inf if OP is ±0, +0 if OP is +Inf, and
-- NaN if OP is negative.
-+ NaN if OP is negative. Warning! Therefore the result on −0 is
-+ different from the one of the rSqrt function recommended by the
-+ IEEE 754-2008 standard (Section 9.2.1), which is −Inf instead of
-+ +Inf.
-
- -- Function: int mpfr_cbrt (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
- -- Function: int mpfr_root (mpfr_t ROP, mpfr_t OP, unsigned long int K,
-@@ -1515,8 +1523,10 @@
- -- Function: int mpfr_log2 (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
- -- Function: int mpfr_log10 (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
- Set ROP to the natural logarithm of OP, log2(OP) or log10(OP),
-- respectively, rounded in the direction RND. Set ROP to −Inf if OP
-- is −0 (i.e., the sign of the zero has no influence on the result).
-+ respectively, rounded in the direction RND. Set ROP to +0 if OP is
-+ 1 (in all rounding modes), for consistency with the ISO C99 and
-+ IEEE 754-2008 standards. Set ROP to −Inf if OP is ±0 (i.e., the
-+ sign of the zero has no influence on the result).
-
- -- Function: int mpfr_exp (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
- -- Function: int mpfr_exp2 (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
-@@ -1649,17 +1659,21 @@
-
- -- Function: int mpfr_lngamma (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
- Set ROP to the value of the logarithm of the Gamma function on OP,
-- rounded in the direction RND. When −2K−1 <= OP <= −2K, K being a
-- non-negative integer, ROP is set to NaN. See also ‘mpfr_lgamma’.
-+ rounded in the direction RND. When OP is 1 or 2, set ROP to +0 (in
-+ all rounding modes). When OP is an infinity or a nonpositive
-+ integer, set ROP to +Inf, following the general rules on special
-+ values. When −2K−1 < OP < −2K, K being a nonnegative integer, set
-+ ROP to NaN. See also ‘mpfr_lgamma’.
-
- -- Function: int mpfr_lgamma (mpfr_t ROP, int *SIGNP, mpfr_t OP,
- mpfr_rnd_t RND)
- Set ROP to the value of the logarithm of the absolute value of the
- Gamma function on OP, rounded in the direction RND. The sign (1 or
- −1) of Gamma(OP) is returned in the object pointed to by SIGNP.
-- When OP is an infinity or a non-positive integer, set ROP to +Inf.
-- When OP is NaN, −Inf or a negative integer, *SIGNP is undefined,
-- and when OP is ±0, *SIGNP is the sign of the zero.
-+ When OP is 1 or 2, set ROP to +0 (in all rounding modes). When OP
-+ is an infinity or a nonpositive integer, set ROP to +Inf. When OP
-+ is NaN, −Inf or a negative integer, *SIGNP is undefined, and when
-+ OP is ±0, *SIGNP is the sign of the zero.
-
- -- Function: int mpfr_digamma (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
- Set ROP to the value of the Digamma (sometimes also called Psi)
-@@ -1703,7 +1717,10 @@
- -- Function: int mpfr_fms (mpfr_t ROP, mpfr_t OP1, mpfr_t OP2, mpfr_t
- OP3, mpfr_rnd_t RND)
- Set ROP to (OP1 times OP2) + OP3 (resp. (OP1 times OP2) - OP3)
-- rounded in the direction RND.
-+ rounded in the direction RND. Concerning special values (signed
-+ zeros, infinities, NaN), these functions behave like a
-+ multiplication followed by a separate addition or subtraction.
-+ That is, the fused operation matters only for rounding.
-
- -- Function: int mpfr_agm (mpfr_t ROP, mpfr_t OP1, mpfr_t OP2,
- mpfr_rnd_t RND)
-@@ -1717,9 +1734,10 @@
- RND)
- Set ROP to the Euclidean norm of X and Y, i.e., the square root of
- the sum of the squares of X and Y, rounded in the direction RND.
-- Special values are handled as described in Section F.9.4.3 of the
-- ISO C99 and IEEE 754-2008 standards: If X or Y is an infinity, then
-- +Inf is returned in ROP, even if the other number is NaN.
-+ Special values are handled as described in the ISO C99 (Section
-+ F.9.4.3) and IEEE 754-2008 (Section 9.2.1) standards: If X or Y is
-+ an infinity, then +Inf is returned in ROP, even if the other number
-+ is NaN.
-
- -- Function: int mpfr_ai (mpfr_t ROP, mpfr_t X, mpfr_rnd_t RND)
- Set ROP to the value of the Airy function Ai on X, rounded in the
-@@ -2670,7 +2688,7 @@
- 5.16 Internals
- ==============
-
--A "limb" means the part of a multi-precision number that fits in a
-+A “limb” means the part of a multi-precision number that fits in a
- single word. Usually a limb contains 32 or 64 bits. The C data type
- for a limb is ‘mp_limb_t’.
-
-@@ -3140,7 +3158,7 @@
- 0. PREAMBLE
-
- The purpose of this License is to make a manual, textbook, or other
-- functional and useful document "free" in the sense of freedom: to
-+ functional and useful document “free” in the sense of freedom: to
- assure everyone the effective freedom to copy and redistribute it,
- with or without modifying it, either commercially or
- noncommercially. Secondarily, this License preserves for the
-@@ -3655,9 +3673,9 @@
- * Menu:
-
- * mpfr_abs: Basic Arithmetic Functions.
-- (line 160)
--* mpfr_acos: Special Functions. (line 51)
--* mpfr_acosh: Special Functions. (line 115)
-+ (line 165)
-+* mpfr_acos: Special Functions. (line 53)
-+* mpfr_acosh: Special Functions. (line 117)
- * mpfr_add: Basic Arithmetic Functions.
- (line 6)
- * mpfr_add_d: Basic Arithmetic Functions.
-@@ -3670,15 +3688,15 @@
- (line 8)
- * mpfr_add_z: Basic Arithmetic Functions.
- (line 14)
--* mpfr_agm: Special Functions. (line 210)
--* mpfr_ai: Special Functions. (line 226)
--* mpfr_asin: Special Functions. (line 52)
--* mpfr_asinh: Special Functions. (line 116)
-+* mpfr_agm: Special Functions. (line 219)
-+* mpfr_ai: Special Functions. (line 236)
-+* mpfr_asin: Special Functions. (line 54)
-+* mpfr_asinh: Special Functions. (line 118)
- * mpfr_asprintf: Formatted Output Functions.
- (line 193)
--* mpfr_atan: Special Functions. (line 53)
--* mpfr_atan2: Special Functions. (line 63)
--* mpfr_atanh: Special Functions. (line 117)
-+* mpfr_atan: Special Functions. (line 55)
-+* mpfr_atan2: Special Functions. (line 65)
-+* mpfr_atanh: Special Functions. (line 119)
- * mpfr_buildopt_decimal_p: Miscellaneous Functions.
- (line 162)
- * mpfr_buildopt_gmpinternals_p: Miscellaneous Functions.
-@@ -3690,7 +3708,7 @@
- * mpfr_can_round: Rounding Related Functions.
- (line 39)
- * mpfr_cbrt: Basic Arithmetic Functions.
-- (line 108)
-+ (line 113)
- * mpfr_ceil: Integer Related Functions.
- (line 7)
- * mpfr_check_range: Exception Related Functions.
-@@ -3735,18 +3753,18 @@
- (line 27)
- * mpfr_cmp_z: Comparison Functions.
- (line 11)
--* mpfr_const_catalan: Special Functions. (line 237)
--* mpfr_const_euler: Special Functions. (line 236)
--* mpfr_const_log2: Special Functions. (line 234)
--* mpfr_const_pi: Special Functions. (line 235)
-+* mpfr_const_catalan: Special Functions. (line 247)
-+* mpfr_const_euler: Special Functions. (line 246)
-+* mpfr_const_log2: Special Functions. (line 244)
-+* mpfr_const_pi: Special Functions. (line 245)
- * mpfr_copysign: Miscellaneous Functions.
- (line 109)
--* mpfr_cos: Special Functions. (line 29)
--* mpfr_cosh: Special Functions. (line 95)
--* mpfr_cot: Special Functions. (line 47)
--* mpfr_coth: Special Functions. (line 111)
--* mpfr_csc: Special Functions. (line 46)
--* mpfr_csch: Special Functions. (line 110)
-+* mpfr_cos: Special Functions. (line 31)
-+* mpfr_cosh: Special Functions. (line 97)
-+* mpfr_cot: Special Functions. (line 49)
-+* mpfr_coth: Special Functions. (line 113)
-+* mpfr_csc: Special Functions. (line 48)
-+* mpfr_csch: Special Functions. (line 112)
- * mpfr_custom_get_exp: Custom Interface. (line 75)
- * mpfr_custom_get_kind: Custom Interface. (line 65)
- * mpfr_custom_get_significand: Custom Interface. (line 70)
-@@ -3756,47 +3774,47 @@
- * mpfr_custom_move: Custom Interface. (line 82)
- * MPFR_DECL_INIT: Initialization Functions.
- (line 74)
--* mpfr_digamma: Special Functions. (line 166)
-+* mpfr_digamma: Special Functions. (line 172)
- * mpfr_dim: Basic Arithmetic Functions.
-- (line 166)
-+ (line 171)
- * mpfr_div: Basic Arithmetic Functions.
-- (line 72)
-+ (line 74)
- * mpfr_divby0_p: Exception Related Functions.
- (line 134)
- * mpfr_div_2exp: Compatibility with MPF.
- (line 49)
- * mpfr_div_2si: Basic Arithmetic Functions.
-- (line 181)
-+ (line 186)
- * mpfr_div_2ui: Basic Arithmetic Functions.
-- (line 179)
-+ (line 184)
- * mpfr_div_d: Basic Arithmetic Functions.
-- (line 84)
-+ (line 86)
- * mpfr_div_q: Basic Arithmetic Functions.
-- (line 88)
-+ (line 90)
- * mpfr_div_si: Basic Arithmetic Functions.
-- (line 80)
-+ (line 82)
- * mpfr_div_ui: Basic Arithmetic Functions.
-- (line 76)
-+ (line 78)
- * mpfr_div_z: Basic Arithmetic Functions.
-- (line 86)
-+ (line 88)
- * mpfr_d_div: Basic Arithmetic Functions.
-- (line 82)
-+ (line 84)
- * mpfr_d_sub: Basic Arithmetic Functions.
-- (line 35)
--* mpfr_eint: Special Functions. (line 133)
-+ (line 36)
-+* mpfr_eint: Special Functions. (line 135)
- * mpfr_eq: Compatibility with MPF.
- (line 28)
- * mpfr_equal_p: Comparison Functions.
- (line 59)
- * mpfr_erangeflag_p: Exception Related Functions.
- (line 137)
--* mpfr_erf: Special Functions. (line 177)
--* mpfr_erfc: Special Functions. (line 178)
--* mpfr_exp: Special Functions. (line 23)
--* mpfr_exp10: Special Functions. (line 25)
--* mpfr_exp2: Special Functions. (line 24)
--* mpfr_expm1: Special Functions. (line 129)
--* mpfr_fac_ui: Special Functions. (line 121)
-+* mpfr_erf: Special Functions. (line 183)
-+* mpfr_erfc: Special Functions. (line 184)
-+* mpfr_exp: Special Functions. (line 25)
-+* mpfr_exp10: Special Functions. (line 27)
-+* mpfr_exp2: Special Functions. (line 26)
-+* mpfr_expm1: Special Functions. (line 131)
-+* mpfr_fac_ui: Special Functions. (line 123)
- * mpfr_fits_intmax_p: Conversion Functions.
- (line 150)
- * mpfr_fits_sint_p: Conversion Functions.
-@@ -3815,20 +3833,20 @@
- (line 147)
- * mpfr_floor: Integer Related Functions.
- (line 8)
--* mpfr_fma: Special Functions. (line 203)
-+* mpfr_fma: Special Functions. (line 209)
- * mpfr_fmod: Integer Related Functions.
- (line 92)
--* mpfr_fms: Special Functions. (line 205)
-+* mpfr_fms: Special Functions. (line 211)
- * mpfr_fprintf: Formatted Output Functions.
- (line 157)
- * mpfr_frac: Integer Related Functions.
- (line 76)
--* mpfr_free_cache: Special Functions. (line 244)
-+* mpfr_free_cache: Special Functions. (line 254)
- * mpfr_free_str: Conversion Functions.
- (line 137)
- * mpfr_frexp: Conversion Functions.
- (line 45)
--* mpfr_gamma: Special Functions. (line 148)
-+* mpfr_gamma: Special Functions. (line 150)
- * mpfr_get_d: Conversion Functions.
- (line 7)
- * mpfr_get_decimal64: Conversion Functions.
-@@ -3887,7 +3905,7 @@
- (line 56)
- * mpfr_greater_p: Comparison Functions.
- (line 55)
--* mpfr_hypot: Special Functions. (line 218)
-+* mpfr_hypot: Special Functions. (line 227)
- * mpfr_inexflag_p: Exception Related Functions.
- (line 136)
- * mpfr_inf_p: Comparison Functions.
-@@ -3922,21 +3940,21 @@
- (line 31)
- * mpfr_integer_p: Integer Related Functions.
- (line 119)
--* mpfr_j0: Special Functions. (line 182)
--* mpfr_j1: Special Functions. (line 183)
--* mpfr_jn: Special Functions. (line 184)
-+* mpfr_j0: Special Functions. (line 188)
-+* mpfr_j1: Special Functions. (line 189)
-+* mpfr_jn: Special Functions. (line 190)
- * mpfr_lessequal_p: Comparison Functions.
- (line 58)
- * mpfr_lessgreater_p: Comparison Functions.
- (line 64)
- * mpfr_less_p: Comparison Functions.
- (line 57)
--* mpfr_lgamma: Special Functions. (line 157)
--* mpfr_li2: Special Functions. (line 143)
--* mpfr_lngamma: Special Functions. (line 152)
-+* mpfr_lgamma: Special Functions. (line 162)
-+* mpfr_li2: Special Functions. (line 145)
-+* mpfr_lngamma: Special Functions. (line 154)
- * mpfr_log: Special Functions. (line 16)
- * mpfr_log10: Special Functions. (line 18)
--* mpfr_log1p: Special Functions. (line 125)
-+* mpfr_log1p: Special Functions. (line 127)
- * mpfr_log2: Special Functions. (line 17)
- * mpfr_max: Miscellaneous Functions.
- (line 22)
-@@ -3947,29 +3965,29 @@
- * mpfr_modf: Integer Related Functions.
- (line 82)
- * mpfr_mul: Basic Arithmetic Functions.
-- (line 51)
-+ (line 53)
- * mpfr_mul_2exp: Compatibility with MPF.
- (line 47)
- * mpfr_mul_2si: Basic Arithmetic Functions.
-- (line 174)
-+ (line 179)
- * mpfr_mul_2ui: Basic Arithmetic Functions.
-- (line 172)
-+ (line 177)
- * mpfr_mul_d: Basic Arithmetic Functions.
-- (line 57)
-+ (line 59)
- * mpfr_mul_q: Basic Arithmetic Functions.
-- (line 61)
-+ (line 63)
- * mpfr_mul_si: Basic Arithmetic Functions.
-- (line 55)
-+ (line 57)
- * mpfr_mul_ui: Basic Arithmetic Functions.
-- (line 53)
-+ (line 55)
- * mpfr_mul_z: Basic Arithmetic Functions.
-- (line 59)
-+ (line 61)
- * mpfr_nanflag_p: Exception Related Functions.
- (line 135)
- * mpfr_nan_p: Comparison Functions.
- (line 39)
- * mpfr_neg: Basic Arithmetic Functions.
-- (line 159)
-+ (line 164)
- * mpfr_nextabove: Miscellaneous Functions.
- (line 15)
- * mpfr_nextbelow: Miscellaneous Functions.
-@@ -3983,13 +4001,13 @@
- * mpfr_overflow_p: Exception Related Functions.
- (line 133)
- * mpfr_pow: Basic Arithmetic Functions.
-- (line 116)
-+ (line 121)
- * mpfr_pow_si: Basic Arithmetic Functions.
-- (line 120)
-+ (line 125)
- * mpfr_pow_ui: Basic Arithmetic Functions.
-- (line 118)
-+ (line 123)
- * mpfr_pow_z: Basic Arithmetic Functions.
-- (line 122)
-+ (line 127)
- * mpfr_prec_round: Rounding Related Functions.
- (line 13)
- * ‘mpfr_prec_t’: Nomenclature and Types.
-@@ -3999,7 +4017,7 @@
- * mpfr_print_rnd_mode: Rounding Related Functions.
- (line 71)
- * mpfr_rec_sqrt: Basic Arithmetic Functions.
-- (line 103)
-+ (line 105)
- * mpfr_regular_p: Comparison Functions.
- (line 43)
- * mpfr_reldiff: Compatibility with MPF.
-@@ -4021,11 +4039,11 @@
- * ‘mpfr_rnd_t’: Nomenclature and Types.
- (line 34)
- * mpfr_root: Basic Arithmetic Functions.
-- (line 109)
-+ (line 114)
- * mpfr_round: Integer Related Functions.
- (line 9)
--* mpfr_sec: Special Functions. (line 45)
--* mpfr_sech: Special Functions. (line 109)
-+* mpfr_sec: Special Functions. (line 47)
-+* mpfr_sech: Special Functions. (line 111)
- * mpfr_set: Assignment Functions.
- (line 9)
- * mpfr_setsign: Miscellaneous Functions.
-@@ -4100,57 +4118,57 @@
- (line 49)
- * mpfr_signbit: Miscellaneous Functions.
- (line 99)
--* mpfr_sin: Special Functions. (line 30)
--* mpfr_sinh: Special Functions. (line 96)
--* mpfr_sinh_cosh: Special Functions. (line 101)
--* mpfr_sin_cos: Special Functions. (line 35)
-+* mpfr_sin: Special Functions. (line 32)
-+* mpfr_sinh: Special Functions. (line 98)
-+* mpfr_sinh_cosh: Special Functions. (line 103)
-+* mpfr_sin_cos: Special Functions. (line 37)
- * mpfr_si_div: Basic Arithmetic Functions.
-- (line 78)
-+ (line 80)
- * mpfr_si_sub: Basic Arithmetic Functions.
-- (line 31)
-+ (line 32)
- * mpfr_snprintf: Formatted Output Functions.
- (line 180)
- * mpfr_sprintf: Formatted Output Functions.
- (line 170)
- * mpfr_sqr: Basic Arithmetic Functions.
-- (line 69)
-+ (line 71)
- * mpfr_sqrt: Basic Arithmetic Functions.
-- (line 96)
-+ (line 98)
- * mpfr_sqrt_ui: Basic Arithmetic Functions.
-- (line 97)
-+ (line 99)
- * mpfr_strtofr: Assignment Functions.
- (line 80)
- * mpfr_sub: Basic Arithmetic Functions.
-- (line 25)
-+ (line 26)
- * mpfr_subnormalize: Exception Related Functions.
- (line 60)
- * mpfr_sub_d: Basic Arithmetic Functions.
-- (line 37)
-+ (line 38)
- * mpfr_sub_q: Basic Arithmetic Functions.
-- (line 43)
-+ (line 44)
- * mpfr_sub_si: Basic Arithmetic Functions.
-- (line 33)
-+ (line 34)
- * mpfr_sub_ui: Basic Arithmetic Functions.
-- (line 29)
-+ (line 30)
- * mpfr_sub_z: Basic Arithmetic Functions.
-- (line 41)
--* mpfr_sum: Special Functions. (line 252)
-+ (line 42)
-+* mpfr_sum: Special Functions. (line 262)
- * mpfr_swap: Assignment Functions.
- (line 150)
- * ‘mpfr_t’: Nomenclature and Types.
- (line 6)
--* mpfr_tan: Special Functions. (line 31)
--* mpfr_tanh: Special Functions. (line 97)
-+* mpfr_tan: Special Functions. (line 33)
-+* mpfr_tanh: Special Functions. (line 99)
- * mpfr_trunc: Integer Related Functions.
- (line 10)
- * mpfr_ui_div: Basic Arithmetic Functions.
-- (line 74)
-+ (line 76)
- * mpfr_ui_pow: Basic Arithmetic Functions.
-- (line 126)
-+ (line 131)
- * mpfr_ui_pow_ui: Basic Arithmetic Functions.
-- (line 124)
-+ (line 129)
- * mpfr_ui_sub: Basic Arithmetic Functions.
-- (line 27)
-+ (line 28)
- * mpfr_underflow_p: Exception Related Functions.
- (line 132)
- * mpfr_unordered_p: Comparison Functions.
-@@ -4181,61 +4199,61 @@
- (line 182)
- * mpfr_vsprintf: Formatted Output Functions.
- (line 171)
--* mpfr_y0: Special Functions. (line 193)
--* mpfr_y1: Special Functions. (line 194)
--* mpfr_yn: Special Functions. (line 195)
-+* mpfr_y0: Special Functions. (line 199)
-+* mpfr_y1: Special Functions. (line 200)
-+* mpfr_yn: Special Functions. (line 201)
- * mpfr_zero_p: Comparison Functions.
- (line 42)
--* mpfr_zeta: Special Functions. (line 171)
--* mpfr_zeta_ui: Special Functions. (line 172)
-+* mpfr_zeta: Special Functions. (line 177)
-+* mpfr_zeta_ui: Special Functions. (line 178)
- * mpfr_z_sub: Basic Arithmetic Functions.
-- (line 39)
-+ (line 40)
-
-
- 
- Tag Table:
- Node: Top775
- Node: Copying2007
--Node: Introduction to MPFR3766
--Node: Installing MPFR5880
--Node: Reporting Bugs11323
--Node: MPFR Basics13353
--Node: Headers and Libraries13669
--Node: Nomenclature and Types16828
--Node: MPFR Variable Conventions18874
--Node: Rounding Modes20418
--Ref: ternary value21544
--Node: Floating-Point Values on Special Numbers23526
--Node: Exceptions26572
--Node: Memory Handling29749
--Node: MPFR Interface30894
--Node: Initialization Functions33008
--Node: Assignment Functions40318
--Node: Combined Initialization and Assignment Functions49673
--Node: Conversion Functions50974
--Node: Basic Arithmetic Functions60035
--Node: Comparison Functions69200
--Node: Special Functions72687
--Node: Input and Output Functions86672
--Node: Formatted Output Functions88644
--Node: Integer Related Functions98431
--Node: Rounding Related Functions105051
--Node: Miscellaneous Functions108888
--Node: Exception Related Functions117568
--Node: Compatibility with MPF124386
--Node: Custom Interface127127
--Node: Internals131526
--Node: API Compatibility133066
--Node: Type and Macro Changes134995
--Node: Added Functions137844
--Node: Changed Functions141132
--Node: Removed Functions145545
--Node: Other Changes145973
--Node: Contributors147576
--Node: References150219
--Node: GNU Free Documentation License151973
--Node: Concept Index174562
--Node: Function and Type Index180659
-+Node: Introduction to MPFR3770
-+Node: Installing MPFR5884
-+Node: Reporting Bugs11327
-+Node: MPFR Basics13357
-+Node: Headers and Libraries13673
-+Node: Nomenclature and Types16832
-+Node: MPFR Variable Conventions18894
-+Node: Rounding Modes20438
-+Ref: ternary value21568
-+Node: Floating-Point Values on Special Numbers23554
-+Node: Exceptions26813
-+Node: Memory Handling29990
-+Node: MPFR Interface31135
-+Node: Initialization Functions33249
-+Node: Assignment Functions40559
-+Node: Combined Initialization and Assignment Functions49914
-+Node: Conversion Functions51215
-+Node: Basic Arithmetic Functions60276
-+Node: Comparison Functions69777
-+Node: Special Functions73264
-+Node: Input and Output Functions87862
-+Node: Formatted Output Functions89834
-+Node: Integer Related Functions99621
-+Node: Rounding Related Functions106241
-+Node: Miscellaneous Functions110078
-+Node: Exception Related Functions118758
-+Node: Compatibility with MPF125576
-+Node: Custom Interface128317
-+Node: Internals132716
-+Node: API Compatibility134260
-+Node: Type and Macro Changes136189
-+Node: Added Functions139038
-+Node: Changed Functions142326
-+Node: Removed Functions146739
-+Node: Other Changes147167
-+Node: Contributors148770
-+Node: References151413
-+Node: GNU Free Documentation License153167
-+Node: Concept Index175760
-+Node: Function and Type Index181857
- 
- End Tag Table
-
-diff -Naurd mpfr-3.1.3-a/src/lngamma.c mpfr-3.1.3-b/src/lngamma.c
---- mpfr-3.1.3-a/src/lngamma.c 2015-06-19 19:55:10.000000000 +0000
-+++ mpfr-3.1.3-b/src/lngamma.c 2015-07-02 10:49:24.018113593 +0000
-@@ -603,16 +603,17 @@
- mpfr_get_prec (y), mpfr_log_prec, y, inex));
-
- /* special cases */
-- if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x)))
-+ if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x) ||
-+ (MPFR_IS_NEG (x) && mpfr_integer_p (x))))
- {
-- if (MPFR_IS_NAN (x) || MPFR_IS_NEG (x))
-+ if (MPFR_IS_NAN (x))
- {
- MPFR_SET_NAN (y);
- MPFR_RET_NAN;
- }
-- else /* lngamma(+Inf) = lngamma(+0) = +Inf */
-+ else /* lngamma(+/-Inf) = lngamma(nonpositive integer) = +Inf */
- {
-- if (MPFR_IS_ZERO (x))
-+ if (!MPFR_IS_INF (x))
- mpfr_set_divby0 ();
- MPFR_SET_INF (y);
- MPFR_SET_POS (y);
-@@ -620,8 +621,8 @@
- }
- }
-
-- /* if x < 0 and -2k-1 <= x <= -2k, then lngamma(x) = NaN */
-- if (MPFR_IS_NEG (x) && (unit_bit (x) == 0 || mpfr_integer_p (x)))
-+ /* if -2k-1 < x < -2k <= 0, then lngamma(x) = NaN */
-+ if (MPFR_IS_NEG (x) && unit_bit (x) == 0)
- {
- MPFR_SET_NAN (y);
- MPFR_RET_NAN;
-diff -Naurd mpfr-3.1.3-a/src/mpfr.h mpfr-3.1.3-b/src/mpfr.h
---- mpfr-3.1.3-a/src/mpfr.h 2015-06-19 19:55:10.000000000 +0000
-+++ mpfr-3.1.3-b/src/mpfr.h 2015-07-02 10:49:24.038113803 +0000
-@@ -27,7 +27,7 @@
- #define MPFR_VERSION_MAJOR 3
- #define MPFR_VERSION_MINOR 1
- #define MPFR_VERSION_PATCHLEVEL 3
--#define MPFR_VERSION_STRING "3.1.3"
-+#define MPFR_VERSION_STRING "3.1.3-p1"
-
- /* Macros dealing with MPFR VERSION */
- #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
-diff -Naurd mpfr-3.1.3-a/src/version.c mpfr-3.1.3-b/src/version.c
---- mpfr-3.1.3-a/src/version.c 2015-06-19 19:55:10.000000000 +0000
-+++ mpfr-3.1.3-b/src/version.c 2015-07-02 10:49:24.042113845 +0000
-@@ -25,5 +25,5 @@
- const char *
- mpfr_get_version (void)
- {
-- return "3.1.3";
-+ return "3.1.3-p1";
- }
-diff -Naurd mpfr-3.1.3-a/tests/tlngamma.c mpfr-3.1.3-b/tests/tlngamma.c
---- mpfr-3.1.3-a/tests/tlngamma.c 2015-06-19 19:55:10.000000000 +0000
-+++ mpfr-3.1.3-b/tests/tlngamma.c 2015-07-02 10:49:24.018113593 +0000
-@@ -33,7 +33,7 @@
- special (void)
- {
- mpfr_t x, y;
-- int inex;
-+ int i, inex;
-
- mpfr_init (x);
- mpfr_init (y);
-@@ -46,25 +46,29 @@
- exit (1);
- }
-
-- mpfr_set_inf (x, -1);
-+ mpfr_set_inf (x, 1);
-+ mpfr_clear_flags ();
- mpfr_lngamma (y, x, MPFR_RNDN);
-- if (!mpfr_nan_p (y))
-+ if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0 || __gmpfr_flags != 0)
- {
-- printf ("Error for lngamma(-Inf)\n");
-+ printf ("Error for lngamma(+Inf)\n");
- exit (1);
- }
-
-- mpfr_set_inf (x, 1);
-+ mpfr_set_inf (x, -1);
-+ mpfr_clear_flags ();
- mpfr_lngamma (y, x, MPFR_RNDN);
-- if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0)
-+ if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0 || __gmpfr_flags != 0)
- {
-- printf ("Error for lngamma(+Inf)\n");
-+ printf ("Error for lngamma(-Inf)\n");
- exit (1);
- }
-
- mpfr_set_ui (x, 0, MPFR_RNDN);
-+ mpfr_clear_flags ();
- mpfr_lngamma (y, x, MPFR_RNDN);
-- if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0)
-+ if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0 ||
-+ __gmpfr_flags != MPFR_FLAGS_DIVBY0)
- {
- printf ("Error for lngamma(+0)\n");
- exit (1);
-@@ -72,32 +76,58 @@
-
- mpfr_set_ui (x, 0, MPFR_RNDN);
- mpfr_neg (x, x, MPFR_RNDN);
-+ mpfr_clear_flags ();
- mpfr_lngamma (y, x, MPFR_RNDN);
-- if (!mpfr_nan_p (y))
-+ if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0 ||
-+ __gmpfr_flags != MPFR_FLAGS_DIVBY0)
- {
- printf ("Error for lngamma(-0)\n");
- exit (1);
- }
-
- mpfr_set_ui (x, 1, MPFR_RNDN);
-+ mpfr_clear_flags ();
- mpfr_lngamma (y, x, MPFR_RNDN);
-- if (MPFR_IS_NAN (y) || mpfr_cmp_ui (y, 0) || MPFR_IS_NEG (y))
-+ if (mpfr_cmp_ui0 (y, 0) || MPFR_IS_NEG (y))
- {
- printf ("Error for lngamma(1)\n");
- exit (1);
- }
-
-- mpfr_set_si (x, -1, MPFR_RNDN);
-- mpfr_lngamma (y, x, MPFR_RNDN);
-- if (!mpfr_nan_p (y))
-+ for (i = 1; i <= 5; i++)
- {
-- printf ("Error for lngamma(-1)\n");
-- exit (1);
-+ int c;
-+
-+ mpfr_set_si (x, -i, MPFR_RNDN);
-+ mpfr_clear_flags ();
-+ mpfr_lngamma (y, x, MPFR_RNDN);
-+ if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0 ||
-+ __gmpfr_flags != MPFR_FLAGS_DIVBY0)
-+ {
-+ printf ("Error for lngamma(-%d)\n", i);
-+ exit (1);
-+ }
-+ if (i & 1)
-+ {
-+ mpfr_nextabove (x);
-+ c = '+';
-+ }
-+ else
-+ {
-+ mpfr_nextbelow (x);
-+ c = '-';
-+ }
-+ mpfr_lngamma (y, x, MPFR_RNDN);
-+ if (!mpfr_nan_p (y))
-+ {
-+ printf ("Error for lngamma(-%d%cepsilon)\n", i, c);
-+ exit (1);
-+ }
- }
-
- mpfr_set_ui (x, 2, MPFR_RNDN);
- mpfr_lngamma (y, x, MPFR_RNDN);
-- if (MPFR_IS_NAN (y) || mpfr_cmp_ui (y, 0) || MPFR_IS_NEG (y))
-+ if (mpfr_cmp_ui0 (y, 0) || MPFR_IS_NEG (y))
- {
- printf ("Error for lngamma(2)\n");
- exit (1);
-@@ -127,7 +157,7 @@
- mpfr_set_str (x, CHECK_X2, 10, MPFR_RNDN);
- mpfr_lngamma (y, x, MPFR_RNDN);
- mpfr_set_str (x, CHECK_Y2, 10, MPFR_RNDN);
-- if (MPFR_IS_NAN (y) || mpfr_cmp (y, x))
-+ if (mpfr_cmp0 (y, x))
- {
- printf ("mpfr_lngamma("CHECK_X2") is wrong:\n"
- "expected ");
-@@ -143,7 +173,7 @@
- mpfr_lngamma (y, x, MPFR_RNDU);
- mpfr_set_prec (x, 175);
- mpfr_set_str_binary (x, "0.1010001100011101101011001101110010100001000001000001110011000001101100001111001001000101011011100100010101011110100111110101010100010011010010000101010111001100011000101111E7");
-- if (MPFR_IS_NAN (y) || mpfr_cmp (x, y))
-+ if (mpfr_cmp0 (x, y))
- {
- printf ("Error in mpfr_lngamma (1)\n");
- exit (1);
-@@ -155,7 +185,7 @@
- mpfr_lngamma (x, y, MPFR_RNDZ);
- mpfr_set_prec (y, 21);
- mpfr_set_str_binary (y, "0.111000101000001100101E9");
-- if (MPFR_IS_NAN (x) || mpfr_cmp (x, y))
-+ if (mpfr_cmp0 (x, y))
- {
- printf ("Error in mpfr_lngamma (120)\n");
- printf ("Expected "); mpfr_print_binary (y); puts ("");
-@@ -169,7 +199,7 @@
- inex = mpfr_lngamma (y, x, MPFR_RNDN);
- mpfr_set_prec (x, 206);
- mpfr_set_str_binary (x, "0.10000111011000000011100010101001100110001110000111100011000100100110110010001011011110101001111011110110000001010100111011010000000011100110110101100111000111010011110010000100010111101010001101000110101001E13");
-- if (MPFR_IS_NAN (y) || mpfr_cmp (x, y))
-+ if (mpfr_cmp0 (x, y))
- {
- printf ("Error in mpfr_lngamma (768)\n");
- exit (1);
-@@ -185,7 +215,7 @@
- mpfr_set_str_binary (x, "0.1100E-66");
- mpfr_lngamma (y, x, MPFR_RNDN);
- mpfr_set_str_binary (x, "0.1100E6");
-- if (MPFR_IS_NAN (y) || mpfr_cmp (x, y))
-+ if (mpfr_cmp0 (x, y))
- {
- printf ("Error for lngamma(0.1100E-66)\n");
- exit (1);
-@@ -199,7 +229,7 @@
- mpfr_lngamma (y, x, MPFR_RNDN);
- mpfr_set_prec (x, 32);
- mpfr_set_str_binary (x, "-0.10001000111011111011000010100010E207");
-- if (MPFR_IS_NAN (y) || mpfr_cmp (x, y))
-+ if (mpfr_cmp0 (x, y))
- {
- printf ("Error for lngamma(-2^199+0.5)\n");
- printf ("Got ");
-diff -Naurd mpfr-3.1.3-a/PATCHES mpfr-3.1.3-b/PATCHES
---- mpfr-3.1.3-a/PATCHES 2015-07-02 10:50:08.046573308 +0000
-+++ mpfr-3.1.3-b/PATCHES 2015-07-02 10:50:08.126574142 +0000
-@@ -0,0 +1 @@
-+muldiv-2exp-overflow
-diff -Naurd mpfr-3.1.3-a/VERSION mpfr-3.1.3-b/VERSION
---- mpfr-3.1.3-a/VERSION 2015-07-02 10:49:24.042113845 +0000
-+++ mpfr-3.1.3-b/VERSION 2015-07-02 10:50:08.126574142 +0000
-@@ -1 +1 @@
--3.1.3-p1
-+3.1.3-p2
-diff -Naurd mpfr-3.1.3-a/src/div_2si.c mpfr-3.1.3-b/src/div_2si.c
---- mpfr-3.1.3-a/src/div_2si.c 2015-06-19 19:55:10.000000000 +0000
-+++ mpfr-3.1.3-b/src/div_2si.c 2015-07-02 10:50:08.106573933 +0000
-@@ -49,7 +49,7 @@
- rnd_mode = MPFR_RNDZ;
- return mpfr_underflow (y, rnd_mode, MPFR_SIGN(y));
- }
-- else if (MPFR_UNLIKELY(n < 0 && (__gmpfr_emax < MPFR_EMIN_MIN - n ||
-+ else if (MPFR_UNLIKELY(n <= 0 && (__gmpfr_emax < MPFR_EMIN_MIN - n ||
- exp > __gmpfr_emax + n)) )
- return mpfr_overflow (y, rnd_mode, MPFR_SIGN(y));
-
-diff -Naurd mpfr-3.1.3-a/src/div_2ui.c mpfr-3.1.3-b/src/div_2ui.c
---- mpfr-3.1.3-a/src/div_2ui.c 2015-06-19 19:55:10.000000000 +0000
-+++ mpfr-3.1.3-b/src/div_2ui.c 2015-07-02 10:50:08.106573933 +0000
-@@ -32,7 +32,7 @@
- rnd_mode),
- ("y[%Pu]=%.*Rg inexact=%d", mpfr_get_prec(y), mpfr_log_prec, y, inexact));
-
-- if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x)))
-+ if (MPFR_UNLIKELY (n == 0 || MPFR_IS_SINGULAR (x)))
- return mpfr_set (y, x, rnd_mode);
- else
- {
-diff -Naurd mpfr-3.1.3-a/src/mpfr.h mpfr-3.1.3-b/src/mpfr.h
---- mpfr-3.1.3-a/src/mpfr.h 2015-07-02 10:49:24.038113803 +0000
-+++ mpfr-3.1.3-b/src/mpfr.h 2015-07-02 10:50:08.126574142 +0000
-@@ -27,7 +27,7 @@
- #define MPFR_VERSION_MAJOR 3
- #define MPFR_VERSION_MINOR 1
- #define MPFR_VERSION_PATCHLEVEL 3
--#define MPFR_VERSION_STRING "3.1.3-p1"
-+#define MPFR_VERSION_STRING "3.1.3-p2"
-
- /* Macros dealing with MPFR VERSION */
- #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
-diff -Naurd mpfr-3.1.3-a/src/mul_2si.c mpfr-3.1.3-b/src/mul_2si.c
---- mpfr-3.1.3-a/src/mul_2si.c 2015-06-19 19:55:10.000000000 +0000
-+++ mpfr-3.1.3-b/src/mul_2si.c 2015-07-02 10:50:08.106573933 +0000
-@@ -39,7 +39,7 @@
- {
- mpfr_exp_t exp = MPFR_GET_EXP (x);
- MPFR_SETRAW (inexact, y, x, exp, rnd_mode);
-- if (MPFR_UNLIKELY( n > 0 && (__gmpfr_emax < MPFR_EMIN_MIN + n ||
-+ if (MPFR_UNLIKELY(n >= 0 && (__gmpfr_emax < MPFR_EMIN_MIN + n ||
- exp > __gmpfr_emax - n)))
- return mpfr_overflow (y, rnd_mode, MPFR_SIGN(y));
- else if (MPFR_UNLIKELY(n < 0 && (__gmpfr_emin > MPFR_EMAX_MAX + n ||
-diff -Naurd mpfr-3.1.3-a/src/version.c mpfr-3.1.3-b/src/version.c
---- mpfr-3.1.3-a/src/version.c 2015-07-02 10:49:24.042113845 +0000
-+++ mpfr-3.1.3-b/src/version.c 2015-07-02 10:50:08.126574142 +0000
-@@ -25,5 +25,5 @@
- const char *
- mpfr_get_version (void)
- {
-- return "3.1.3-p1";
-+ return "3.1.3-p2";
- }
-diff -Naurd mpfr-3.1.3-a/tests/tmul_2exp.c mpfr-3.1.3-b/tests/tmul_2exp.c
---- mpfr-3.1.3-a/tests/tmul_2exp.c 2015-06-19 19:55:10.000000000 +0000
-+++ mpfr-3.1.3-b/tests/tmul_2exp.c 2015-07-02 10:50:08.106573933 +0000
-@@ -242,6 +242,76 @@
- large (MPFR_EMAX_MAX);
- }
-
-+/* Cases where the function overflows on n = 0 when rounding is like
-+ away from zero. */
-+static void
-+overflow0 (mpfr_exp_t emax)
-+{
-+ mpfr_exp_t old_emax;
-+ mpfr_t x, y1, y2;
-+ int neg, r, op;
-+ static char *sop[4] = { "mul_2ui", "mul_2si", "div_2ui", "div_2si" };
-+
-+ old_emax = mpfr_get_emax ();
-+ set_emax (emax);
-+
-+ mpfr_init2 (x, 8);
-+ mpfr_inits2 (6, y1, y2, (mpfr_ptr) 0);
-+
-+ mpfr_set_inf (x, 1);
-+ mpfr_nextbelow (x);
-+
-+ for (neg = 0; neg <= 1; neg++)
-+ {
-+ RND_LOOP (r)
-+ {
-+ int inex1, inex2;
-+ unsigned int flags1, flags2;
-+
-+ /* Even if there isn't an overflow (rounding ~ toward zero),
-+ the result is the same as the one of an overflow. */
-+ inex1 = mpfr_overflow (y1, (mpfr_rnd_t) r, neg ? -1 : 1);
-+ flags1 = MPFR_FLAGS_INEXACT;
-+ if (mpfr_inf_p (y1))
-+ flags1 |= MPFR_FLAGS_OVERFLOW;
-+ for (op = 0; op < 4; op++)
-+ {
-+ mpfr_clear_flags ();
-+ inex2 =
-+ op == 0 ? mpfr_mul_2ui (y2, x, 0, (mpfr_rnd_t) r) :
-+ op == 1 ? mpfr_mul_2si (y2, x, 0, (mpfr_rnd_t) r) :
-+ op == 2 ? mpfr_div_2ui (y2, x, 0, (mpfr_rnd_t) r) :
-+ op == 3 ? mpfr_div_2si (y2, x, 0, (mpfr_rnd_t) r) :
-+ (MPFR_ASSERTN (0), 0);
-+ flags2 = __gmpfr_flags;
-+ if (!(mpfr_equal_p (y1, y2) &&
-+ SAME_SIGN (inex1, inex2) &&
-+ flags1 == flags2))
-+ {
-+ printf ("Error in overflow0 for %s, mpfr_%s, emax = %"
-+ MPFR_EXP_FSPEC "d,\nx = ",
-+ mpfr_print_rnd_mode ((mpfr_rnd_t) r), sop[op],
-+ (mpfr_eexp_t) emax);
-+ mpfr_dump (x);
-+ printf ("Expected ");
-+ mpfr_dump (y1);
-+ printf (" with inex = %d, flags =", inex1);
-+ flags_out (flags1);
-+ printf ("Got ");
-+ mpfr_dump (y2);
-+ printf (" with inex = %d, flags =", inex2);
-+ flags_out (flags2);
-+ exit (1);
-+ }
-+ }
-+ }
-+ mpfr_neg (x, x, MPFR_RNDN);
-+ }
-+
-+ mpfr_clears (x, y1, y2, (mpfr_ptr) 0);
-+ set_emax (old_emax);
-+}
-+
- int
- main (int argc, char *argv[])
- {
-@@ -334,6 +404,11 @@
- underflow0 ();
- large0 ();
-
-+ if (mpfr_get_emax () != MPFR_EMAX_MAX)
-+ overflow0 (mpfr_get_emax ());
-+ overflow0 (MPFR_EMAX_MAX);
-+ overflow0 (-1);
-+
- tests_end_mpfr ();
- return 0;
- }
-diff -Naurd mpfr-3.1.3-a/PATCHES mpfr-3.1.3-b/PATCHES
---- mpfr-3.1.3-a/PATCHES 2015-07-17 08:54:48.592799981 +0000
-+++ mpfr-3.1.3-b/PATCHES 2015-07-17 08:54:48.616811495 +0000
-@@ -0,0 +1 @@
-+muldiv-2exp-underflow
-diff -Naurd mpfr-3.1.3-a/VERSION mpfr-3.1.3-b/VERSION
---- mpfr-3.1.3-a/VERSION 2015-07-02 10:50:08.126574142 +0000
-+++ mpfr-3.1.3-b/VERSION 2015-07-17 08:54:48.616811495 +0000
-@@ -1 +1 @@
--3.1.3-p2
-+3.1.3-p3
-diff -Naurd mpfr-3.1.3-a/src/div_2si.c mpfr-3.1.3-b/src/div_2si.c
---- mpfr-3.1.3-a/src/div_2si.c 2015-07-02 10:50:08.106573933 +0000
-+++ mpfr-3.1.3-b/src/div_2si.c 2015-07-17 08:54:48.608807656 +0000
-@@ -45,7 +45,8 @@
- if (rnd_mode == MPFR_RNDN &&
- (__gmpfr_emin > MPFR_EMAX_MAX - (n - 1) ||
- exp < __gmpfr_emin + (n - 1) ||
-- (inexact >= 0 && mpfr_powerof2_raw (y))))
-+ ((MPFR_IS_NEG (y) ? inexact <= 0 : inexact >= 0) &&
-+ mpfr_powerof2_raw (y))))
- rnd_mode = MPFR_RNDZ;
- return mpfr_underflow (y, rnd_mode, MPFR_SIGN(y));
- }
-diff -Naurd mpfr-3.1.3-a/src/div_2ui.c mpfr-3.1.3-b/src/div_2ui.c
---- mpfr-3.1.3-a/src/div_2ui.c 2015-07-02 10:50:08.106573933 +0000
-+++ mpfr-3.1.3-b/src/div_2ui.c 2015-07-17 08:54:48.608807656 +0000
-@@ -44,7 +44,9 @@
- if (MPFR_UNLIKELY (n >= diffexp)) /* exp - n <= emin - 1 */
- {
- if (rnd_mode == MPFR_RNDN &&
-- (n > diffexp || (inexact >= 0 && mpfr_powerof2_raw (y))))
-+ (n > diffexp ||
-+ ((MPFR_IS_NEG (y) ? inexact <= 0 : inexact >= 0) &&
-+ mpfr_powerof2_raw (y))))
- rnd_mode = MPFR_RNDZ;
- return mpfr_underflow (y, rnd_mode, MPFR_SIGN (y));
- }
-diff -Naurd mpfr-3.1.3-a/src/mpfr.h mpfr-3.1.3-b/src/mpfr.h
---- mpfr-3.1.3-a/src/mpfr.h 2015-07-02 10:50:08.126574142 +0000
-+++ mpfr-3.1.3-b/src/mpfr.h 2015-07-17 08:54:48.616811495 +0000
-@@ -27,7 +27,7 @@
- #define MPFR_VERSION_MAJOR 3
- #define MPFR_VERSION_MINOR 1
- #define MPFR_VERSION_PATCHLEVEL 3
--#define MPFR_VERSION_STRING "3.1.3-p2"
-+#define MPFR_VERSION_STRING "3.1.3-p3"
-
- /* Macros dealing with MPFR VERSION */
- #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
-diff -Naurd mpfr-3.1.3-a/src/mul_2si.c mpfr-3.1.3-b/src/mul_2si.c
---- mpfr-3.1.3-a/src/mul_2si.c 2015-07-02 10:50:08.106573933 +0000
-+++ mpfr-3.1.3-b/src/mul_2si.c 2015-07-17 08:54:48.608807656 +0000
-@@ -48,7 +48,8 @@
- if (rnd_mode == MPFR_RNDN &&
- (__gmpfr_emin > MPFR_EMAX_MAX + (n + 1) ||
- exp < __gmpfr_emin - (n + 1) ||
-- (inexact >= 0 && mpfr_powerof2_raw (y))))
-+ ((MPFR_IS_NEG (y) ? inexact <= 0 : inexact >= 0) &&
-+ mpfr_powerof2_raw (y))))
- rnd_mode = MPFR_RNDZ;
- return mpfr_underflow (y, rnd_mode, MPFR_SIGN(y));
- }
-diff -Naurd mpfr-3.1.3-a/src/version.c mpfr-3.1.3-b/src/version.c
---- mpfr-3.1.3-a/src/version.c 2015-07-02 10:50:08.126574142 +0000
-+++ mpfr-3.1.3-b/src/version.c 2015-07-17 08:54:48.616811495 +0000
-@@ -25,5 +25,5 @@
- const char *
- mpfr_get_version (void)
- {
-- return "3.1.3-p2";
-+ return "3.1.3-p3";
- }
-diff -Naurd mpfr-3.1.3-a/tests/tmul_2exp.c mpfr-3.1.3-b/tests/tmul_2exp.c
---- mpfr-3.1.3-a/tests/tmul_2exp.c 2015-07-02 10:50:08.106573933 +0000
-+++ mpfr-3.1.3-b/tests/tmul_2exp.c 2015-07-17 08:54:48.608807656 +0000
-@@ -50,77 +50,82 @@
- {
- mpfr_t x, y, z1, z2;
- mpfr_exp_t emin;
-- int i, k;
-+ int i, k, s;
- int prec;
- int rnd;
- int div;
- int inex1, inex2;
- unsigned int flags1, flags2;
-
-- /* Test mul_2si(x, e - k), div_2si(x, k - e) and div_2ui(x, k - e)
-- * with emin = e, x = 1 + i/16, i in { -1, 0, 1 }, and k = 1 to 4,
-- * by comparing the result with the one of a simple division.
-+ /* Test mul_2si(x, e - k), div_2si(x, k - e) and div_2ui(x, k - e) with
-+ * emin = e, x = s * (1 + i/16), i in { -1, 0, 1 }, s in { -1, 1 }, and
-+ * k = 1 to 4, by comparing the result with the one of a simple division.
- */
- emin = mpfr_get_emin ();
- set_emin (e);
- mpfr_inits2 (8, x, y, (mpfr_ptr) 0);
- for (i = 15; i <= 17; i++)
-- {
-- inex1 = mpfr_set_ui_2exp (x, i, -4, MPFR_RNDN);
-- MPFR_ASSERTN (inex1 == 0);
-- for (prec = 6; prec >= 3; prec -= 3)
-- {
-- mpfr_inits2 (prec, z1, z2, (mpfr_ptr) 0);
-- RND_LOOP (rnd)
-- for (k = 1; k <= 4; k++)
-- {
-- /* The following one is assumed to be correct. */
-- inex1 = mpfr_mul_2si (y, x, e, MPFR_RNDN);
-- MPFR_ASSERTN (inex1 == 0);
-- inex1 = mpfr_set_ui (z1, 1 << k, MPFR_RNDN);
-- MPFR_ASSERTN (inex1 == 0);
-- mpfr_clear_flags ();
-- /* Do not use mpfr_div_ui to avoid the optimization
-- by mpfr_div_2si. */
-- inex1 = mpfr_div (z1, y, z1, (mpfr_rnd_t) rnd);
-- flags1 = __gmpfr_flags;
--
-- for (div = 0; div <= 2; div++)
-+ for (s = 1; s >= -1; s -= 2)
-+ {
-+ inex1 = mpfr_set_si_2exp (x, s * i, -4, MPFR_RNDN);
-+ MPFR_ASSERTN (inex1 == 0);
-+ for (prec = 6; prec >= 3; prec -= 3)
-+ {
-+ mpfr_inits2 (prec, z1, z2, (mpfr_ptr) 0);
-+ RND_LOOP (rnd)
-+ for (k = 1; k <= 4; k++)
- {
-+ /* The following one is assumed to be correct. */
-+ inex1 = mpfr_mul_2si (y, x, e, MPFR_RNDN);
-+ MPFR_ASSERTN (inex1 == 0);
-+ inex1 = mpfr_set_ui (z1, 1 << k, MPFR_RNDN);
-+ MPFR_ASSERTN (inex1 == 0);
- mpfr_clear_flags ();
-- inex2 = div == 0 ?
-- mpfr_mul_2si (z2, x, e - k, (mpfr_rnd_t) rnd) : div == 1 ?
-- mpfr_div_2si (z2, x, k - e, (mpfr_rnd_t) rnd) :
-- mpfr_div_2ui (z2, x, k - e, (mpfr_rnd_t) rnd);
-- flags2 = __gmpfr_flags;
-- if (flags1 == flags2 && SAME_SIGN (inex1, inex2) &&
-- mpfr_equal_p (z1, z2))
-- continue;
-- printf ("Error in underflow(");
-- if (e == MPFR_EMIN_MIN)
-- printf ("MPFR_EMIN_MIN");
-- else if (e == emin)
-- printf ("default emin");
-- else if (e >= LONG_MIN)
-- printf ("%ld", (long) e);
-- else
-- printf ("<LONG_MIN");
-- printf (") with mpfr_%s,\nx = %d/16, prec = %d, k = %d, "
-- "%s\n", div == 0 ? "mul_2si" : div == 1 ?
-- "div_2si" : "div_2ui", i, prec, k,
-- mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
-- printf ("Expected ");
-- mpfr_out_str (stdout, 16, 0, z1, MPFR_RNDN);
-- printf (", inex = %d, flags = %u\n", SIGN (inex1), flags1);
-- printf ("Got ");
-- mpfr_out_str (stdout, 16, 0, z2, MPFR_RNDN);
-- printf (", inex = %d, flags = %u\n", SIGN (inex2), flags2);
-- exit (1);
-- } /* div */
-- } /* k */
-- mpfr_clears (z1, z2, (mpfr_ptr) 0);
-- } /* prec */
-- } /* i */
-+ /* Do not use mpfr_div_ui to avoid the optimization
-+ by mpfr_div_2si. */
-+ inex1 = mpfr_div (z1, y, z1, (mpfr_rnd_t) rnd);
-+ flags1 = __gmpfr_flags;
-+
-+ for (div = 0; div <= 2; div++)
-+ {
-+ mpfr_clear_flags ();
-+ inex2 =
-+ div == 0 ?
-+ mpfr_mul_2si (z2, x, e - k, (mpfr_rnd_t) rnd) :
-+ div == 1 ?
-+ mpfr_div_2si (z2, x, k - e, (mpfr_rnd_t) rnd) :
-+ mpfr_div_2ui (z2, x, k - e, (mpfr_rnd_t) rnd);
-+ flags2 = __gmpfr_flags;
-+ if (flags1 == flags2 && SAME_SIGN (inex1, inex2) &&
-+ mpfr_equal_p (z1, z2))
-+ continue;
-+ printf ("Error in underflow(");
-+ if (e == MPFR_EMIN_MIN)
-+ printf ("MPFR_EMIN_MIN");
-+ else if (e == emin)
-+ printf ("default emin");
-+ else if (e >= LONG_MIN)
-+ printf ("%ld", (long) e);
-+ else
-+ printf ("<LONG_MIN");
-+ printf (") with mpfr_%s,\nx = %d/16, prec = %d, k = %d,"
-+ " %s\n", div == 0 ? "mul_2si" : div == 1 ?
-+ "div_2si" : "div_2ui", s * i, prec, k,
-+ mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
-+ printf ("Expected ");
-+ mpfr_out_str (stdout, 16, 0, z1, MPFR_RNDN);
-+ printf (", inex = %d, flags = %u\n",
-+ SIGN (inex1), flags1);
-+ printf ("Got ");
-+ mpfr_out_str (stdout, 16, 0, z2, MPFR_RNDN);
-+ printf (", inex = %d, flags = %u\n",
-+ SIGN (inex2), flags2);
-+ exit (1);
-+ } /* div */
-+ } /* k */
-+ mpfr_clears (z1, z2, (mpfr_ptr) 0);
-+ } /* prec */
-+ } /* i */
- mpfr_clears (x, y, (mpfr_ptr) 0);
- set_emin (emin);
- }
-diff -Naurd mpfr-3.1.3-a/PATCHES mpfr-3.1.3-b/PATCHES
---- mpfr-3.1.3-a/PATCHES 2015-07-17 08:58:21.094987384 +0000
-+++ mpfr-3.1.3-b/PATCHES 2015-07-17 08:58:21.118986898 +0000
-@@ -0,0 +1 @@
-+frexp
-diff -Naurd mpfr-3.1.3-a/VERSION mpfr-3.1.3-b/VERSION
---- mpfr-3.1.3-a/VERSION 2015-07-17 08:54:48.616811495 +0000
-+++ mpfr-3.1.3-b/VERSION 2015-07-17 08:58:21.118986898 +0000
-@@ -1 +1 @@
--3.1.3-p3
-+3.1.3-p4
-diff -Naurd mpfr-3.1.3-a/src/frexp.c mpfr-3.1.3-b/src/frexp.c
---- mpfr-3.1.3-a/src/frexp.c 2015-06-19 19:55:09.000000000 +0000
-+++ mpfr-3.1.3-b/src/frexp.c 2015-07-17 08:58:21.106987142 +0000
-@@ -26,6 +26,13 @@
- mpfr_frexp (mpfr_exp_t *exp, mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd)
- {
- int inex;
-+ unsigned int saved_flags = __gmpfr_flags;
-+ MPFR_BLOCK_DECL (flags);
-+
-+ MPFR_LOG_FUNC
-+ (("x[%Pu]=%.*Rg rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, rnd),
-+ ("y[%Pu]=%.*Rg exp=%" MPFR_EXP_FSPEC "d inex=%d", mpfr_get_prec (y),
-+ mpfr_log_prec, y, (mpfr_eexp_t) *exp, inex));
-
- if (MPFR_UNLIKELY(MPFR_IS_SINGULAR(x)))
- {
-@@ -49,8 +56,32 @@
- }
- }
-
-- inex = mpfr_set (y, x, rnd);
-+ MPFR_BLOCK (flags, inex = mpfr_set (y, x, rnd));
-+ __gmpfr_flags = saved_flags;
-+
-+ /* Possible overflow due to the rounding, no possible underflow. */
-+
-+ if (MPFR_UNLIKELY (MPFR_OVERFLOW (flags)))
-+ {
-+ int inex2;
-+
-+ /* An overflow here means that the exponent of y would be larger than
-+ the one of x, thus x would be rounded to the next power of 2, and
-+ the returned y should be 1/2 in absolute value, rounded (i.e. with
-+ possible underflow or overflow). This also implies that x and y are
-+ different objects, so that the exponent of x has not been lost. */
-+ MPFR_LOG_MSG (("Internal overflow\n", 0));
-+ MPFR_ASSERTD (x != y);
-+ *exp = MPFR_GET_EXP (x) + 1;
-+ inex2 = mpfr_set_si_2exp (y, MPFR_INT_SIGN (x), -1, rnd);
-+ MPFR_LOG_MSG (("inex=%d inex2=%d\n", inex, inex2));
-+ if (inex2 != 0)
-+ inex = inex2;
-+ MPFR_RET (inex);
-+ }
-+
- *exp = MPFR_GET_EXP (y);
-- MPFR_SET_EXP (y, 0);
-+ /* Do not use MPFR_SET_EXP because the range has not been checked yet. */
-+ MPFR_EXP (y) = 0;
- return mpfr_check_range (y, inex, rnd);
- }
-diff -Naurd mpfr-3.1.3-a/src/mpfr.h mpfr-3.1.3-b/src/mpfr.h
---- mpfr-3.1.3-a/src/mpfr.h 2015-07-17 08:54:48.616811495 +0000
-+++ mpfr-3.1.3-b/src/mpfr.h 2015-07-17 08:58:21.114986979 +0000
-@@ -27,7 +27,7 @@
- #define MPFR_VERSION_MAJOR 3
- #define MPFR_VERSION_MINOR 1
- #define MPFR_VERSION_PATCHLEVEL 3
--#define MPFR_VERSION_STRING "3.1.3-p3"
-+#define MPFR_VERSION_STRING "3.1.3-p4"
-
- /* Macros dealing with MPFR VERSION */
- #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
-diff -Naurd mpfr-3.1.3-a/src/version.c mpfr-3.1.3-b/src/version.c
---- mpfr-3.1.3-a/src/version.c 2015-07-17 08:54:48.616811495 +0000
-+++ mpfr-3.1.3-b/src/version.c 2015-07-17 08:58:21.118986898 +0000
-@@ -25,5 +25,5 @@
- const char *
- mpfr_get_version (void)
- {
-- return "3.1.3-p3";
-+ return "3.1.3-p4";
- }
-diff -Naurd mpfr-3.1.3-a/tests/tfrexp.c mpfr-3.1.3-b/tests/tfrexp.c
---- mpfr-3.1.3-a/tests/tfrexp.c 2015-06-19 19:55:10.000000000 +0000
-+++ mpfr-3.1.3-b/tests/tfrexp.c 2015-07-17 08:58:21.106987142 +0000
-@@ -129,12 +129,115 @@
- mpfr_clear (x);
- }
-
-+static void check1 (void)
-+{
-+ mpfr_exp_t emin, emax, e;
-+ mpfr_t x, y1, y2;
-+ int r, neg, red;
-+
-+ emin = mpfr_get_emin ();
-+ emax = mpfr_get_emax ();
-+ set_emin (MPFR_EMIN_MIN);
-+ set_emax (MPFR_EMAX_MAX);
-+
-+ mpfr_init2 (x, 7);
-+ mpfr_inits2 (4, y1, y2, (mpfr_ptr) 0);
-+
-+ mpfr_set_ui_2exp (x, 1, -2, MPFR_RNDN);
-+ while (mpfr_regular_p (x))
-+ {
-+ /* Test the exponents up to 3 and with the maximum exponent
-+ (to check potential intermediate overflow). */
-+ if (MPFR_GET_EXP (x) == 4)
-+ mpfr_set_exp (x, MPFR_EMAX_MAX);
-+ e = MPFR_GET_EXP (x);
-+ for (neg = 0; neg < 2; neg++)
-+ {
-+ RND_LOOP (r)
-+ {
-+ int inex1, inex2;
-+ mpfr_exp_t e1, e2;
-+ unsigned int flags1, flags2;
-+
-+ for (red = 0; red < 2; red++)
-+ {
-+ if (red)
-+ {
-+ /* e1: exponent of the rounded value of x. */
-+ MPFR_ASSERTN (e1 == e || e1 == e + 1);
-+ set_emin (e);
-+ set_emax (e);
-+ mpfr_clear_flags ();
-+ inex1 = e1 < 0 ?
-+ mpfr_mul_2ui (y1, x, -e1, (mpfr_rnd_t) r) :
-+ mpfr_div_2ui (y1, x, e1, (mpfr_rnd_t) r);
-+ flags1 = __gmpfr_flags;
-+ }
-+ else
-+ {
-+ inex1 = mpfr_set (y1, x, (mpfr_rnd_t) r);
-+ e1 = MPFR_IS_INF (y1) ? e + 1 : MPFR_GET_EXP (y1);
-+ flags1 = inex1 != 0 ? MPFR_FLAGS_INEXACT : 0;
-+ }
-+ mpfr_clear_flags ();
-+ inex2 = mpfr_frexp (&e2, y2, x, (mpfr_rnd_t) r);
-+ flags2 = __gmpfr_flags;
-+ set_emin (MPFR_EMIN_MIN);
-+ set_emax (MPFR_EMAX_MAX);
-+ if ((!red || e == 0) &&
-+ (! mpfr_regular_p (y2) || MPFR_GET_EXP (y2) != 0))
-+ {
-+ printf ("Error in check1 for %s, red = %d, x = ",
-+ mpfr_print_rnd_mode ((mpfr_rnd_t) r), red);
-+ mpfr_dump (x);
-+ printf ("Expected 1/2 <= |y| < 1, got y = ");
-+ mpfr_dump (y2);
-+ exit (1);
-+ }
-+ if (!red)
-+ {
-+ if (e2 > 0)
-+ mpfr_mul_2ui (y2, y2, e2, MPFR_RNDN);
-+ else if (e2 < 0)
-+ mpfr_div_2ui (y2, y2, -e2, MPFR_RNDN);
-+ }
-+ if (! (SAME_SIGN (inex1, inex2) &&
-+ mpfr_equal_p (y1, y2) &&
-+ flags1 == flags2))
-+ {
-+ printf ("Error in check1 for %s, red = %d, x = ",
-+ mpfr_print_rnd_mode ((mpfr_rnd_t) r), red);
-+ mpfr_dump (x);
-+ printf ("Expected y1 = ");
-+ mpfr_dump (y1);
-+ printf ("Got y2 = ");
-+ mpfr_dump (y2);
-+ printf ("Expected inex ~= %d, got %d\n", inex1, inex2);
-+ printf ("Expected flags:");
-+ flags_out (flags1);
-+ printf ("Got flags: ");
-+ flags_out (flags2);
-+ exit (1);
-+ }
-+ }
-+ }
-+ mpfr_neg (x, x, MPFR_RNDN);
-+ }
-+ mpfr_nextabove (x);
-+ }
-+
-+ mpfr_clears (x, y1, y2, (mpfr_ptr) 0);
-+ set_emin (emin);
-+ set_emax (emax);
-+}
-+
- int
- main (int argc, char *argv[])
- {
- tests_start_mpfr ();
-
- check_special ();
-+ check1 ();
-
- tests_end_mpfr ();
- return 0;
-diff -Naurd mpfr-3.1.3-a/PATCHES mpfr-3.1.3-b/PATCHES
---- mpfr-3.1.3-a/PATCHES 2015-10-29 13:47:46.735901185 +0000
-+++ mpfr-3.1.3-b/PATCHES 2015-10-29 13:47:46.763900609 +0000
-@@ -0,0 +1 @@
-+divhigh-basecase
-diff -Naurd mpfr-3.1.3-a/VERSION mpfr-3.1.3-b/VERSION
---- mpfr-3.1.3-a/VERSION 2015-07-17 08:58:21.118986898 +0000
-+++ mpfr-3.1.3-b/VERSION 2015-10-29 13:47:46.763900609 +0000
-@@ -1 +1 @@
--3.1.3-p4
-+3.1.3-p5
-diff -Naurd mpfr-3.1.3-a/src/mpfr.h mpfr-3.1.3-b/src/mpfr.h
---- mpfr-3.1.3-a/src/mpfr.h 2015-07-17 08:58:21.114986979 +0000
-+++ mpfr-3.1.3-b/src/mpfr.h 2015-10-29 13:47:46.759900692 +0000
-@@ -27,7 +27,7 @@
- #define MPFR_VERSION_MAJOR 3
- #define MPFR_VERSION_MINOR 1
- #define MPFR_VERSION_PATCHLEVEL 3
--#define MPFR_VERSION_STRING "3.1.3-p4"
-+#define MPFR_VERSION_STRING "3.1.3-p5"
-
- /* Macros dealing with MPFR VERSION */
- #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
-diff -Naurd mpfr-3.1.3-a/src/mulders.c mpfr-3.1.3-b/src/mulders.c
---- mpfr-3.1.3-a/src/mulders.c 2015-06-19 19:55:10.000000000 +0000
-+++ mpfr-3.1.3-b/src/mulders.c 2015-10-29 13:47:46.751900855 +0000
-@@ -236,9 +236,10 @@
- that in addition to the limb np[n-1] to reduce, we have at least 2
- extra limbs, thus accessing np[n-3] is valid. */
-
-- /* warning: we can have np[n-1]=d1 and np[n-2]=d0, but since {np,n} < D,
-- the largest possible partial quotient is B-1 */
-- if (MPFR_UNLIKELY(np[n - 1] == d1 && np[n - 2] == d0))
-+ /* Warning: we can have np[n-1]>d1 or (np[n-1]=d1 and np[n-2]>=d0) here,
-+ since we truncate the divisor at each step, but since {np,n} < D
-+ originally, the largest possible partial quotient is B-1. */
-+ if (MPFR_UNLIKELY(np[n-1] > d1 || (np[n-1] == d1 && np[n-2] >= d0)))
- q2 = ~ (mp_limb_t) 0;
- else
- udiv_qr_3by2 (q2, q1, q0, np[n - 1], np[n - 2], np[n - 3],
-diff -Naurd mpfr-3.1.3-a/src/version.c mpfr-3.1.3-b/src/version.c
---- mpfr-3.1.3-a/src/version.c 2015-07-17 08:58:21.118986898 +0000
-+++ mpfr-3.1.3-b/src/version.c 2015-10-29 13:47:46.763900609 +0000
-@@ -25,5 +25,5 @@
- const char *
- mpfr_get_version (void)
- {
-- return "3.1.3-p4";
-+ return "3.1.3-p5";
- }
-diff -Naurd mpfr-3.1.3-a/tests/tdiv.c mpfr-3.1.3-b/tests/tdiv.c
---- mpfr-3.1.3-a/tests/tdiv.c 2015-06-19 19:55:10.000000000 +0000
-+++ mpfr-3.1.3-b/tests/tdiv.c 2015-10-29 13:47:46.751900855 +0000
-@@ -1099,6 +1099,69 @@
- mpfr_set_emax (old_emax);
- }
-
-+/* Bug in mpfr_divhigh_n_basecase when all limbs of q (except the most
-+ significant one) are B-1 where B=2^GMP_NUMB_BITS. Since we truncate
-+ the divisor at each step, it might happen at some point that
-+ (np[n-1],np[n-2]) > (d1,d0), and not only the equality.
-+ Reported by Ricky Farr
-+ <https://sympa.inria.fr/sympa/arc/mpfr/2015-10/msg00023.html>
-+ To get a failure, a MPFR_DIVHIGH_TAB entry below the MPFR_DIV_THRESHOLD
-+ limit must have a value 0. With most mparam.h files, this cannot occur. */
-+static void
-+test_20151023 (void)
-+{
-+ mpfr_prec_t p;
-+ mpfr_t n, d, q, q0;
-+ int inex, i;
-+
-+ for (p = GMP_NUMB_BITS; p <= 2000; p++)
-+ {
-+ mpfr_init2 (n, 2*p);
-+ mpfr_init2 (d, p);
-+ mpfr_init2 (q, p);
-+ mpfr_init2 (q0, GMP_NUMB_BITS);
-+
-+ /* generate a random divisor of p bits */
-+ mpfr_urandomb (d, RANDS);
-+ /* generate a random quotient of GMP_NUMB_BITS bits */
-+ mpfr_urandomb (q0, RANDS);
-+ /* zero-pad the quotient to p bits */
-+ inex = mpfr_prec_round (q0, p, MPFR_RNDN);
-+ MPFR_ASSERTN(inex == 0);
-+
-+ for (i = 0; i < 3; i++)
-+ {
-+ /* i=0: try with the original quotient xxx000...000
-+ i=1: try with the original quotient minus one ulp
-+ i=2: try with the original quotient plus one ulp */
-+ if (i == 1)
-+ mpfr_nextbelow (q0);
-+ else if (i == 2)
-+ {
-+ mpfr_nextabove (q0);
-+ mpfr_nextabove (q0);
-+ }
-+
-+ inex = mpfr_mul (n, d, q0, MPFR_RNDN);
-+ MPFR_ASSERTN(inex == 0);
-+ mpfr_nextabove (n);
-+ mpfr_div (q, n, d, MPFR_RNDN);
-+ MPFR_ASSERTN(mpfr_cmp (q, q0) == 0);
-+
-+ inex = mpfr_mul (n, d, q0, MPFR_RNDN);
-+ MPFR_ASSERTN(inex == 0);
-+ mpfr_nextbelow (n);
-+ mpfr_div (q, n, d, MPFR_RNDN);
-+ MPFR_ASSERTN(mpfr_cmp (q, q0) == 0);
-+ }
-+
-+ mpfr_clear (n);
-+ mpfr_clear (d);
-+ mpfr_clear (q);
-+ mpfr_clear (q0);
-+ }
-+}
-+
- #define TEST_FUNCTION test_div
- #define TWO_ARGS
- #define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), randlimb () % 100, RANDS)
-@@ -1219,6 +1282,7 @@
- consistency ();
- test_20070603 ();
- test_20070628 ();
-+ test_20151023 ();
- test_generic (2, 800, 50);
- test_extreme ();
-
diff --git a/libre/ncurses-static/PKGBUILD b/libre/ncurses-static/PKGBUILD
deleted file mode 100644
index f11ede9f0..000000000
--- a/libre/ncurses-static/PKGBUILD
+++ /dev/null
@@ -1,44 +0,0 @@
-# Maintainer: Márcio Silva <coadde@parabola.nu>
-# based of ncurses
-
-_pkgname=ncurses
-pkgname=ncurses-static
-pkgver=6.0
-pkgrel=4
-pkgdesc='System V Release 4.0 curses emulation library (static libraries only)'
-arch=('i686' 'x86_64' 'armv7h')
-url='http://invisible-island.net/ncurses/ncurses.html'
-license=('MIT')
-depends=('gcc-libs-static' 'ncurses')
-options=('staticlibs')
-source=(ftp://invisible-island.net/ncurses/ncurses-${pkgver/_/-}.tar.gz{,.asc})
-md5sums=('ee13d052e1ead260d7c28071f46eefb1'
- 'SKIP')
-validpgpkeys=('C52048C0C0748FEE227D47A2702353E0F7E48EDB') # Thomas Dickey
-
-build() {
- cd $_pkgname-${pkgver/_/-}
-
- ./configure --prefix=/usr \
- --without-shared --with-normal --without-debug --without-ada \
- --enable-widec --enable-pc-files --with-cxx-binding --without-cxx-shared \
- --enable-ext-colors --enable-ext-mouse
- make
-}
-
-package() {
- cd $_pkgname-${pkgver/_/-}
- make DESTDIR="$pkgdir" install
-
- # fool packages looking to link to non-wide-character ncurses libraries
- for lib in ncurses ncurses++ form panel menu; do
- echo "INPUT(-l${lib}w)" > "$pkgdir"/usr/lib/lib${lib}.a
- done
-
- # some packages look for -lcurses during build
- echo "INPUT(-lncursesw)" > "$pkgdir"/usr/lib/libcursesw.a
- ln -s libncurses.a "$pkgdir"/usr/lib/libcurses.a
-
- # remove conflicting files
- rm -vr ${pkgdir}/usr/{bin,include,lib/{pkgconfig,terminfo},share}
-}
diff --git a/libre/nspr-static/PKGBUILD b/libre/nspr-static/PKGBUILD
deleted file mode 100644
index f8ef0bd71..000000000
--- a/libre/nspr-static/PKGBUILD
+++ /dev/null
@@ -1,43 +0,0 @@
-# Maintainer: Márcio Silva <coadde@parabola.nu>
-# based of nspr
-
-_pkgname=nspr
-pkgname=nspr-static
-pkgver=4.12
-pkgrel=1
-pkgdesc="Netscape Portable Runtime (static libraries only)"
-arch=(i686 x86_64 armv7h)
-url="http://www.mozilla.org/projects/nspr/"
-license=('MPL' 'GPL')
-depends=('nspr')
-makedepends=('zip')
-options=('!emptydirs' 'staticlibs')
-source=(https://ftp.mozilla.org/pub/mozilla.org/nspr/releases/v${pkgver}/src/${_pkgname}-${pkgver}.tar.gz)
-sha1sums=('14fb67a0e686a5c662f92e7f59dfd10053f327dd')
-sha256sums=('e0b10a1e569153668ff8bdea6c7e491b389fab69c2f18285a1ebf7c2ea4269de')
-
-build() {
- cd $_pkgname-$pkgver
-
- if [ "$CARCH" = "x86_64" ]; then
- _confflags="--enable-64bit"
- else
- _confflags=""
- fi
-
- ./nspr/configure \
- --prefix=/usr \
- --libdir=/usr/lib \
- --enable-optimize \
- --disable-debug ${_confflags}
- make
-}
-
-package() {
- cd $_pkgname-$pkgver
- make DESTDIR="$pkgdir" install
-
- # remove conflicting files
- rm -vr ${pkgdir}/usr/{bin,include,lib/pkgconfig,share}
- rm -v ${pkgdir}/usr/lib/lib*.so*
-}
diff --git a/libre/readline-static/PKGBUILD b/libre/readline-static/PKGBUILD
deleted file mode 100644
index 049901772..000000000
--- a/libre/readline-static/PKGBUILD
+++ /dev/null
@@ -1,71 +0,0 @@
-# Maintainer: Márcio Silva <coadde@parabola.nu>
-# based of readline
-
-_pkgname=readline
-pkgname=readline-static
-_basever=6.3
-_patchlevel=008
-pkgver=$_basever.$_patchlevel
-pkgrel=3
-pkgdesc='GNU readline library (static libraries only)'
-arch=('i686' 'x86_64' 'armv7h')
-url='http://tiswww.case.edu/php/chet/readline/rltop.html'
-license=('GPL')
-depends=('ncurses-static' 'readline')
-options=('!emptydirs' 'staticlibs')
-source=(http://ftp.gnu.org/gnu/readline/readline-$_basever.tar.gz{,.sig})
-validpgpkeys=('7C0135FB088AAF6C66C650B9BB5869F064EA74AB') # Chet Ramey
-
-if [ $_patchlevel -gt 0 ]; then
- for (( _p=1; _p <= $((10#${_patchlevel})); _p++ )); do
- source=(${source[@]} http://ftp.gnu.org/gnu/readline/readline-$_basever-patches/readline${_basever//.}-$(printf "%03d" $_p){,.sig})
- done
-fi
-
-prepare() {
- cd $_pkgname-$_basever
- for (( _p=1; _p <= $((10#${_patchlevel})); _p++ )); do
- msg "applying patch readline${_basever//.}-$(printf "%03d" $_p)"
- patch -p0 -i ../readline${_basever//.}-$(printf "%03d" $_p)
- done
-
- # remove RPATH from shared objects (FS#14366)
- sed -i 's|-Wl,-rpath,$(libdir) ||g' support/shobj-conf
-}
-
-build() {
- cd $_pkgname-$_basever
-
- # build with -fPIC for x86_64 (FS#15634)
- [[ $CARCH == "x86_64" ]] && CFLAGS="$CFLAGS -fPIC"
-
- ./configure --prefix=/usr
- make SHLIB_LIBS=-lncurses
-}
-
-package() {
- make -C $_pkgname-$_basever DESTDIR="$pkgdir" install
-
- # remove conflicting files
- rm -vr ${pkgdir}/usr/{include,share}
- rm -v ${pkgdir}/usr/lib/lib*.so*
-}
-
-md5sums=('33c8fb279e981274f485fd91da77e94a'
- 'SKIP'
- '4343f5ea9b0f42447f102fb61576b398'
- 'SKIP'
- '700295212f7e2978577feaee584afddb'
- 'SKIP'
- 'af4963862f5156fbf9111c2c6fa86ed7'
- 'SKIP'
- '11f9def89803a5052db3ba72394ce14f'
- 'SKIP'
- '93721c31cd225393f80cb3aadb165544'
- 'SKIP'
- '71dc6ecce66d1489b96595f55d142a52'
- 'SKIP'
- '062a08ed60679d3c4878710b3d595b65'
- 'SKIP'
- 'ee1c04072154826870848d8b218d7b04'
- 'SKIP')