Skip to content

Commit

Permalink
Merge pull request #3 from yyyyx4/public/35302
Browse files Browse the repository at this point in the history
patches for PARI 2.15.3
  • Loading branch information
dimpase authored Apr 19, 2023
2 parents fbbc3d5 + 2f987c7 commit c9dd627
Show file tree
Hide file tree
Showing 6 changed files with 92 additions and 190 deletions.
2 changes: 1 addition & 1 deletion build/pkgs/pari/package-version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.15.3
2.15.3.p1

This file was deleted.

25 changes: 25 additions & 0 deletions build/pkgs/pari/patches/bug2466.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
From 7ca0c2eae87def89fa7253c60e4791a8ef26629d Mon Sep 17 00:00:00 2001
From: Bill Allombert <Bill.Allombert@math.u-bordeaux.fr>
Date: Mon, 3 Apr 2023 15:30:26 +0200
Subject: [PATCH] quadunitindex(8461,2)->1 instead of 3 [#2466]

---
src/basemath/quad.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/basemath/quad.c b/src/basemath/quad.c
index 021a404b00..7ed554c2f3 100644
--- a/src/basemath/quad.c
+++ b/src/basemath/quad.c
@@ -359,7 +359,7 @@ quadunit_mod(GEN D, GEN N)
GEN M = shifti(mulii(q, N), 1);
quadunit_uvmod(D, d, M, &u, &v);
u = diviiexact(u, q);
- v = diviiexact(v, q); u = shifti(u,-1);
+ v = modii(diviiexact(v, q), N); u = shifti(u,-1);
}
return deg1pol_shallow(v, u, 0);
}
--
2.40.0

39 changes: 39 additions & 0 deletions build/pkgs/pari/patches/bug2469.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
diff --git a/src/basemath/ifactor1.c b/src/basemath/ifactor1.c
index 526ac5c1b3..5fb4454353 100644
--- a/src/basemath/ifactor1.c
+++ b/src/basemath/ifactor1.c
@@ -3595,7 +3595,7 @@ ifactor_sign(GEN n, ulong all, long hint, long sn, GEN *pU)
{
GEN M, N;
pari_sp av;
- long nb = 0, nb0 = 0, i;
+ long nb = 0, nb0 = -1, i;
ulong lim;
forprime_t T;

@@ -3666,7 +3666,7 @@ ifactor_sign(GEN n, ulong all, long hint, long sn, GEN *pU)
affii(n, N); n = N; set_avma(av3);
STOREu(&nb, p, k);
}
- if (p == 16381 && bit_accuracy(lgefint(n)) < 2048)
+ if (!stop && p == 16381 && bit_accuracy(lgefint(n)) < 2048)
{ stop = ifac_isprime(n); nb0 = nb; }
if (stop)
{
@@ -3706,15 +3706,14 @@ ifactor_sign(GEN n, ulong all, long hint, long sn, GEN *pU)
long k;
av = avma;
k = isanypower_nosmalldiv(n, &x);
- if (k > 1) affii(x, n);
+ if (k > 1) { affii(x, n); nb0 = -1; }
if (pU)
{
GEN F;
if (abscmpiu(n, lim) <= 0
|| cmpii(n, sqru(lim)) <= 0
- || ((nb > nb0 || k > 1)
- && bit_accuracy(lgefint(n)) < 2048 && ifac_isprime(n)))
+ || (nb > nb0 && bit_accuracy(lgefint(n)) < 2048 && ifac_isprime(n)))
{ set_avma(av); STOREi(&nb, n, k); return aux_end(M,n, nb); }
set_avma(av); F = aux_end(M, NULL, nb); /* don't destroy n */
*pU = mkvec2(icopy(n), utoipos(k)); /* composite cofactor */
19 changes: 19 additions & 0 deletions build/pkgs/pari/spkg-configure.m4
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,25 @@ SAGE_SPKG_CONFIGURE([pari], [
AC_MSG_NOTICE([Otherwise Sage will build its own pari/GP.])
sage_spkg_install_pari=yes
fi
AC_MSG_CHECKING([whether factor() bug 2469 of pari 2.15.3 is fixed])
result=`echo "f=factor(2^2203-1); print(\"ok\")" | timeout 1 $GP -qf`
if test x"$result" = xok; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no; cannot use system pari/GP with known bug])
sage_spkg_install_pari=yes
fi
AC_MSG_CHECKING([whether qfbclassno() bug 2466 of pari 2.15.3 is fixed])
result=`echo "qfbclassno(33844)" | $GP -qf`
if test x"$result" = x3; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no; cannot use system pari/GP with known bug])
sage_spkg_install_pari=yes
fi
fi dnl end GP test
if test x$sage_spkg_install_pari = xno; then dnl main PARI test
Expand Down
8 changes: 8 additions & 0 deletions src/sage/rings/number_field/order.py
Original file line number Diff line number Diff line change
Expand Up @@ -1038,6 +1038,14 @@ def class_number(self, proof=None):
...
NotImplementedError: computation of class numbers of non-maximal orders not in quadratic fields is not implemented
TESTS:
Test for PARI bug #2466::
sage: x = polygen(ZZ)
sage: R.<t> = EquationOrder(x^2 - 8461)
sage: R.class_number()
3
"""
if not self.is_maximal():
K = self.number_field()
Expand Down

0 comments on commit c9dd627

Please sign in to comment.