Louis . Granboulan on Wed, 18 Feb 1998 16:00:06 +0100


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

Re: Possible pari-2.0.5/gp bug


> ? factor(3*s^4-140*s^2-4537/9*s-4900/9)
>   ***   the PARI stack overflows !!!

The behaviour is different on many other OS :
? factor(3*s^4-140*s^2-4537/9*s-4900/9)
  ***   division by zero in gdiv, gdivgs or ginv

The patch below solves this.
*** ./src/basemath/polarit2.c.orig	Sat Feb  7 17:11:57 1998
--- ./src/basemath/polarit2.c	Wed Feb 18 15:52:45 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 (!gcmp1(leading_term(x))) 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;