Karim BELABAS on Mon, 14 Dec 1998 18:48:37 +0100 (MET)


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: new nfdisc() bug in 2.0.12 and later


[Igor:]
> nfdisc(x^4-6*x^3-9*x^2-6*x+1)
> 
> doubles stack to memory exhaustion.

A typo in 2.0.12 (I had swapped the cases "p huge" and "p small", so that the
latter could enter an infinite loop). Here's a patch.

Karim (2.0.13 is nearly ready anyway, but if you can't wait...)

*** src/basemath/base2.c.orig   Thu Dec 10 11:38:28 1998
--- src/basemath/base2.c        Mon Dec 14 18:41:54 1998
***************
*** 911,917 ****
    pp = p[2]; if (lgef(p)>3 || pp<0) pp=0;
    for (t=1; ; t++)
    {
!     h = pp? scalarpol(stoi(t),v): stopoly(t,pp,v);
      theta = gadd(gamma,gmod(h,fa));
      w=factcp(p,fa,theta); h=(GEN)w[3];
      if (h[2] > 1)
--- 911,917 ----
    pp = p[2]; if (lgef(p)>3 || pp<0) pp=0;
    for (t=1; ; t++)
    {
!     h = pp? stopoly(t,pp,v): scalarpol(stoi(t),v);
      theta = gadd(gamma,gmod(h,fa));
      w=factcp(p,fa,theta); h=(GEN)w[3];
      if (h[2] > 1)
***************
*** 1070,1076 ****
    pp = p[2]; if (lgef(p)>3 || pp<0) pp=0;
    for (t=1; ; t++)
    {
!     h = pp? scalarpol(stoi(t),v): stopoly(t,pp,v);
      phi = gadd(theta,gmod(h,fa));
      w=factcp(p,fa,phi); h=(GEN)w[3];
      if (h[2] > 1)
--- 1070,1076 ----
    pp = p[2]; if (lgef(p)>3 || pp<0) pp=0;
    for (t=1; ; t++)
    {
!     h = pp? stopoly(t,pp,v): scalarpol(stoi(t),v);
      phi = gadd(theta,gmod(h,fa));
      w=factcp(p,fa,phi); h=(GEN)w[3];
      if (h[2] > 1)
--
Karim Belabas                    email: Karim.Belabas@math.u-psud.fr
Dep. de Mathematiques, Bat. 425
Universite Paris-Sud             Tel: (00 33) 1 69 15 57 48
F-91405 Orsay (France)           Fax: (00 33) 1 69 15 60 19
--
PARI/GP Home Page: http://pari.home.ml.org