* update mpfr to 4.2.1-1

This commit is contained in:
Alexander Baldeck 2023-09-19 19:49:47 +02:00
parent 640a8e1d2a
commit 057224e871
3 changed files with 30 additions and 2495 deletions

View File

@ -5,31 +5,45 @@
# Contributor: damir <damir@archlinux.org>
pkgname=mpfr
_pkgver=4.2.0
_patchver=12
pkgrel=3
pkgver=${_pkgver}.p${_patchver}
#pkgver=$_pkgver
_pkgver=4.2.1
_patchver=0
if (( _patchver == 0 )); then
pkgver=$_pkgver
else
pkgver=$_pkgver.p$_patchver
fi
pkgrel=1
pkgdesc='Multiple-precision floating-point library'
arch=(x86_64 powerpc64le powerpc64 powerpc riscv64)
url='https://www.mpfr.org/'
license=(GPL3 LGPL3)
depends=(glibc gmp)
source=(https://ftp.gnu.org/gnu/mpfr/mpfr-${_pkgver}.tar.xz{,.sig}
patches.diff) # wget https://www.mpfr.org/mpfr-${_pkgver}/allpatches -O patches.diff
sha512sums=('58e843125884ca58837ae5159cd4092af09e8f21931a2efd19c15de057c9d1dc0753ae95c592e2ce59a727fbc491af776db8b00a055320413cdcf2033b90505c'
'SKIP'
'c3de1907648cbf1a87d292bc017f1f651ed4449eb28459187821199016e0f12e7cb3b45d6163c9a4361d3b7499f5b6f771b271edcfa93399f3c28c1180b3b387')
b2sums=('dd88ae3a6a910ad8faeb791b49c3b1085de5d0d4c49c637c124bf4d9bc79fb621d0d1d69e07d0642b9b678f6d355a5830d083dfd189e1e91d0e04c970c10bd64'
'SKIP'
'0c8e3da9057defe4289a9665f27ec03d2312d58bf6b2a108d089097d6b22fbc5b9fe92b1cb8607c3bd53f8b93d82c5db6a467a0d7881ed8e893560a24b33e061')
license=(
GPL-3.0-or-later
LGPL-3.0-or-later
)
depends=(
glibc
gmp
)
provides=(libmpfr.so)
# NOTE: download potentially existing patches from upstream:
# `curl patches.diff -o https://www.mpfr.org/mpfr-${_pkgver}/allpatches`
source=(https://ftp.gnu.org/gnu/$pkgname/$pkgname-$_pkgver.tar.xz{,.sig})
sha512sums=('bc68c0d755d5446403644833ecbb07e37360beca45f474297b5d5c40926df1efc3e2067eecffdf253f946288bcca39ca89b0613f545d46a9e767d1d4cf358475'
'SKIP')
b2sums=('ad69f53bc910294647523e7613b18a683f1d0f3dd994168ab2a46b66d0371ffa9b8e7cb59495f898470aea69d343e83fc722f11babe4af7b3a12665a1e65860c'
'SKIP')
validpgpkeys=('07F3DBBECC1A39605078094D980C197698C3739D'
'A534BE3F83E241D918280AEB5831D11A0D4DB02A') # Vincent Lefevre <vincent@vinc17.net>
prepare() {
cd $pkgname-${_pkgver}
patch -p1 -i ../patches.diff
for src in "${source[@]}"; do
[[ "$src" == *.diff ]] || [[ "$src" == *.patch ]] || continue
printf "Applying patch %s...\n" "$src"
patch -Np1 -i "../$src"
done
autoreconf -fiv
}

View File

@ -1,285 +0,0 @@
diff -Naurd mpfr-3.1.6-a/PATCHES mpfr-3.1.6-b/PATCHES
--- mpfr-3.1.6-a/PATCHES 2017-10-26 13:55:51.168013439 +0000
+++ mpfr-3.1.6-b/PATCHES 2017-10-26 13:55:51.236013121 +0000
@@ -0,0 +1 @@
+mpfr_get
diff -Naurd mpfr-3.1.6-a/VERSION mpfr-3.1.6-b/VERSION
--- mpfr-3.1.6-a/VERSION 2017-09-07 11:36:44.000000000 +0000
+++ mpfr-3.1.6-b/VERSION 2017-10-26 13:55:51.236013121 +0000
@@ -1 +1 @@
-3.1.6
+3.1.6-p1
diff -Naurd mpfr-3.1.6-a/src/get_ld.c mpfr-3.1.6-b/src/get_ld.c
--- mpfr-3.1.6-a/src/get_ld.c 2017-01-01 01:39:09.000000000 +0000
+++ mpfr-3.1.6-b/src/get_ld.c 2017-10-26 13:55:51.208013252 +0000
@@ -41,6 +41,9 @@
mpfr_exp_t sh; /* exponent shift, so that x/2^sh is in the double range */
mpfr_t y, z;
int sign;
+ MPFR_SAVE_EXPO_DECL (expo);
+
+ MPFR_SAVE_EXPO_MARK (expo);
/* first round x to the target long double precision, so that
all subsequent operations are exact (this avoids double rounding
@@ -103,6 +106,7 @@
}
if (sign < 0)
r = -r;
+ MPFR_SAVE_EXPO_FREE (expo);
return r;
}
}
diff -Naurd mpfr-3.1.6-a/src/get_si.c mpfr-3.1.6-b/src/get_si.c
--- mpfr-3.1.6-a/src/get_si.c 2017-01-01 01:39:09.000000000 +0000
+++ mpfr-3.1.6-b/src/get_si.c 2017-10-26 13:55:51.208013252 +0000
@@ -28,6 +28,7 @@
mpfr_prec_t prec;
long s;
mpfr_t x;
+ MPFR_SAVE_EXPO_DECL (expo);
if (MPFR_UNLIKELY (!mpfr_fits_slong_p (f, rnd)))
{
@@ -39,14 +40,22 @@
if (MPFR_IS_ZERO (f))
return (long) 0;
- /* determine prec of long */
- for (s = LONG_MIN, prec = 0; s != 0; s /= 2, prec++)
+ /* Determine the precision of long. |LONG_MIN| may have one more bit
+ as an integer, but in this case, this is a power of 2, thus fits
+ in a precision-prec floating-point number. */
+ for (s = LONG_MAX, prec = 0; s != 0; s /= 2, prec++)
{ }
+ MPFR_SAVE_EXPO_MARK (expo);
+
/* first round to prec bits */
mpfr_init2 (x, prec);
mpfr_rint (x, f, rnd);
+ /* The flags from mpfr_rint are the wanted ones. In particular,
+ it sets the inexact flag when necessary. */
+ MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, __gmpfr_flags);
+
/* warning: if x=0, taking its exponent is illegal */
if (MPFR_UNLIKELY (MPFR_IS_ZERO(x)))
s = 0;
@@ -65,5 +74,7 @@
mpfr_clear (x);
+ MPFR_SAVE_EXPO_FREE (expo);
+
return s;
}
diff -Naurd mpfr-3.1.6-a/src/get_sj.c mpfr-3.1.6-b/src/get_sj.c
--- mpfr-3.1.6-a/src/get_sj.c 2017-01-01 01:39:09.000000000 +0000
+++ mpfr-3.1.6-b/src/get_sj.c 2017-10-26 13:55:51.208013252 +0000
@@ -35,6 +35,7 @@
intmax_t r;
mpfr_prec_t prec;
mpfr_t x;
+ MPFR_SAVE_EXPO_DECL (expo);
if (MPFR_UNLIKELY (!mpfr_fits_intmax_p (f, rnd)))
{
@@ -46,20 +47,24 @@
if (MPFR_IS_ZERO (f))
return (intmax_t) 0;
- /* determine the precision of intmax_t */
- for (r = MPFR_INTMAX_MIN, prec = 0; r != 0; r /= 2, prec++)
+ /* Determine the precision of intmax_t. |INTMAX_MIN| may have one
+ more bit as an integer, but in this case, this is a power of 2,
+ thus fits in a precision-prec floating-point number. */
+ for (r = MPFR_INTMAX_MAX, prec = 0; r != 0; r /= 2, prec++)
{ }
- /* Note: though INTMAX_MAX would have been sufficient for the conversion,
- we chose INTMAX_MIN so that INTMAX_MIN - 1 is always representable in
- precision prec; this is useful to detect overflows in MPFR_RNDZ (will
- be needed later). */
- /* Now, r = 0. */
+ MPFR_ASSERTD (r == 0);
+
+ MPFR_SAVE_EXPO_MARK (expo);
mpfr_init2 (x, prec);
mpfr_rint (x, f, rnd);
MPFR_ASSERTN (MPFR_IS_FP (x));
+ /* The flags from mpfr_rint are the wanted ones. In particular,
+ it sets the inexact flag when necessary. */
+ MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, __gmpfr_flags);
+
if (MPFR_NOTZERO (x))
{
mp_limb_t *xp;
@@ -67,15 +72,15 @@
xp = MPFR_MANT (x);
sh = MPFR_GET_EXP (x);
- MPFR_ASSERTN ((mpfr_prec_t) sh <= prec);
+ MPFR_ASSERTN ((mpfr_prec_t) sh <= prec + 1);
if (MPFR_INTMAX_MIN + MPFR_INTMAX_MAX != 0
- && MPFR_UNLIKELY ((mpfr_prec_t) sh == prec))
+ && MPFR_UNLIKELY ((mpfr_prec_t) sh > prec))
{
/* 2's complement and x <= INTMAX_MIN: in the case mp_limb_t
has the same size as intmax_t, we cannot use the code in
the for loop since the operations would be performed in
unsigned arithmetic. */
- MPFR_ASSERTN (MPFR_IS_NEG (x) && (mpfr_powerof2_raw (x)));
+ MPFR_ASSERTN (MPFR_IS_NEG (x) && mpfr_powerof2_raw (x));
r = MPFR_INTMAX_MIN;
}
else if (MPFR_IS_POS (x))
@@ -117,6 +122,8 @@
mpfr_clear (x);
+ MPFR_SAVE_EXPO_FREE (expo);
+
return r;
}
diff -Naurd mpfr-3.1.6-a/src/get_ui.c mpfr-3.1.6-b/src/get_ui.c
--- mpfr-3.1.6-a/src/get_ui.c 2017-01-01 01:39:09.000000000 +0000
+++ mpfr-3.1.6-b/src/get_ui.c 2017-10-26 13:55:51.208013252 +0000
@@ -30,6 +30,7 @@
mpfr_t x;
mp_size_t n;
mpfr_exp_t exp;
+ MPFR_SAVE_EXPO_DECL (expo);
if (MPFR_UNLIKELY (!mpfr_fits_ulong_p (f, rnd)))
{
@@ -44,10 +45,16 @@
for (s = ULONG_MAX, prec = 0; s != 0; s /= 2, prec ++)
{ }
+ MPFR_SAVE_EXPO_MARK (expo);
+
/* first round to prec bits */
mpfr_init2 (x, prec);
mpfr_rint (x, f, rnd);
+ /* The flags from mpfr_rint are the wanted ones. In particular,
+ it sets the inexact flag when necessary. */
+ MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, __gmpfr_flags);
+
/* warning: if x=0, taking its exponent is illegal */
if (MPFR_IS_ZERO(x))
s = 0;
@@ -61,5 +68,7 @@
mpfr_clear (x);
+ MPFR_SAVE_EXPO_FREE (expo);
+
return s;
}
diff -Naurd mpfr-3.1.6-a/src/get_uj.c mpfr-3.1.6-b/src/get_uj.c
--- mpfr-3.1.6-a/src/get_uj.c 2017-01-01 01:39:09.000000000 +0000
+++ mpfr-3.1.6-b/src/get_uj.c 2017-10-26 13:55:51.208013252 +0000
@@ -35,6 +35,7 @@
uintmax_t r;
mpfr_prec_t prec;
mpfr_t x;
+ MPFR_SAVE_EXPO_DECL (expo);
if (MPFR_UNLIKELY (!mpfr_fits_uintmax_p (f, rnd)))
{
@@ -50,12 +51,18 @@
for (r = MPFR_UINTMAX_MAX, prec = 0; r != 0; r /= 2, prec++)
{ }
- /* Now, r = 0. */
+ MPFR_ASSERTD (r == 0);
+
+ MPFR_SAVE_EXPO_MARK (expo);
mpfr_init2 (x, prec);
mpfr_rint (x, f, rnd);
MPFR_ASSERTN (MPFR_IS_FP (x));
+ /* The flags from mpfr_rint are the wanted ones. In particular,
+ it sets the inexact flag when necessary. */
+ MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, __gmpfr_flags);
+
if (MPFR_NOTZERO (x))
{
mp_limb_t *xp;
@@ -76,6 +83,8 @@
mpfr_clear (x);
+ MPFR_SAVE_EXPO_FREE (expo);
+
return r;
}
diff -Naurd mpfr-3.1.6-a/src/get_z.c mpfr-3.1.6-b/src/get_z.c
--- mpfr-3.1.6-a/src/get_z.c 2017-01-01 01:39:09.000000000 +0000
+++ mpfr-3.1.6-b/src/get_z.c 2017-10-26 13:55:51.208013252 +0000
@@ -29,6 +29,7 @@
int inex;
mpfr_t r;
mpfr_exp_t exp;
+ MPFR_SAVE_EXPO_DECL (expo);
if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (f)))
{
@@ -41,6 +42,8 @@
return 0;
}
+ MPFR_SAVE_EXPO_MARK (expo);
+
exp = MPFR_GET_EXP (f);
/* if exp <= 0, then |f|<1, thus |o(f)|<=1 */
MPFR_ASSERTN (exp < 0 || exp <= MPFR_PREC_MAX);
@@ -50,6 +53,11 @@
MPFR_ASSERTN (inex != 1 && inex != -1); /* integral part of f is
representable in r */
MPFR_ASSERTN (MPFR_IS_FP (r));
+
+ /* The flags from mpfr_rint are the wanted ones. In particular,
+ it sets the inexact flag when necessary. */
+ MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, __gmpfr_flags);
+
exp = mpfr_get_z_2exp (z, r);
if (exp >= 0)
mpz_mul_2exp (z, z, exp);
@@ -57,5 +65,7 @@
mpz_fdiv_q_2exp (z, z, -exp);
mpfr_clear (r);
+ MPFR_SAVE_EXPO_FREE (expo);
+
return inex;
}
diff -Naurd mpfr-3.1.6-a/src/mpfr.h mpfr-3.1.6-b/src/mpfr.h
--- mpfr-3.1.6-a/src/mpfr.h 2017-09-07 11:36:44.000000000 +0000
+++ mpfr-3.1.6-b/src/mpfr.h 2017-10-26 13:55:51.232013138 +0000
@@ -27,7 +27,7 @@
#define MPFR_VERSION_MAJOR 3
#define MPFR_VERSION_MINOR 1
#define MPFR_VERSION_PATCHLEVEL 6
-#define MPFR_VERSION_STRING "3.1.6"
+#define MPFR_VERSION_STRING "3.1.6-p1"
/* Macros dealing with MPFR VERSION */
#define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
diff -Naurd mpfr-3.1.6-a/src/version.c mpfr-3.1.6-b/src/version.c
--- mpfr-3.1.6-a/src/version.c 2017-09-07 11:36:44.000000000 +0000
+++ mpfr-3.1.6-b/src/version.c 2017-10-26 13:55:51.232013138 +0000
@@ -25,5 +25,5 @@
const char *
mpfr_get_version (void)
{
- return "3.1.6";
+ return "3.1.6-p1";
}

File diff suppressed because it is too large Load Diff