Karim Belabas on Wed, 18 Feb 1998 16:33:29 +0100 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: Possible pari-2.0.5/gp bug |
Roland Dreier wrote (msg 55): > > ? factor(3*s^4-140*s^2-4537/9*s-4900/9) > *** the PARI stack overflows !!! The code in factpol() mistakenly assumed the polynomial to have integer coefficients AND leading term +/- 1 (that's two bugs in one line, the first one being fatal). (this was introduced in a 2.0 pre-release while making sure that factors always have positive leading coeff.) Instead of Louis patch (msg 56) which fixes only the fatal one, apply the patch below. Karim. =========================== patch 13 (2.0.5.alpha) =========================== *** src/basemath/polarit2.c.orig Wed Feb 18 16:15:52 1998 --- src/basemath/polarit2.c Fri Feb 13 13:43:07 1998 *************** *** 437,443 **** p1 = cgetg(1,t_VEC); fa=cgetg(lx,t_VEC); for (i=1; i<lx; i++) fa[i] = (long)p1; d=content(x); ! if (!gcmp1(leading_term(x))) d = negi(d); if (!gcmp1(d)) x=gdiv(x,d); vv=varn(x); xp=deriv(x,vv); t=ggcd(x,xp); v=gdiv(x,t); w=gdiv(xp,t); j=0; f=1; nbfac=0; --- 437,443 ---- p1 = cgetg(1,t_VEC); fa=cgetg(lx,t_VEC); for (i=1; i<lx; i++) fa[i] = (long)p1; d=content(x); ! if (gsigne(leading_term(x)) < 0) d = gneg(d); if (!gcmp1(d)) x=gdiv(x,d); vv=varn(x); xp=deriv(x,vv); t=ggcd(x,xp); v=gdiv(x,t); w=gdiv(xp,t); j=0; f=1; nbfac=0; *************** -- Karim Belabas e-mail: Max-Planck-Institut fuer Mathematik karim@mpim-bonn.mpg.de Gottfried-Claren-Str. 26 tel: 53225 Bonn (Germany) (00 49 228) 402-245