Karim BELABAS on Mon, 4 Oct 1999 13:17:39 +0200 (MET DST) |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: type() bug in gp |
[Michael Somos:] > gp> y=1/x > %1 = 1/x > gp> type(y) > %2 = "t_RFRAC" > gp> type(y,RFRAC) > %3 = 1/x > gp> type(y,RFRACN) > *** the PARI stack overflows !!! Infinite recursion. Here's a patch. Karim. Index: src/basemath/polarit1.c =================================================================== RCS file: /home/megrez/cvsroot/pari/src/basemath/polarit1.c,v retrieving revision 1.2 diff -c -r1.2 polarit1.c *** src/basemath/polarit1.c 1999/09/23 17:50:56 1.2 --- src/basemath/polarit1.c 1999/10/04 10:59:34 *************** *** 103,109 **** { GEN p1,p2,x2,x3; ! x2=content((GEN)x[2]); if (gcmp1(x2)) return gcopy(x); x3=gdiv((GEN)x[1],x2); p2=denom(x3); x2=gdiv((GEN)x[2],x2); --- 103,110 ---- { GEN p1,p2,x2,x3; ! x2=content((GEN)x[2]); ! if (gcmp1(x2)) { x = gcopy(x); settyp(x, t_RFRAC); return gcopy(x); } x3=gdiv((GEN)x[1],x2); p2=denom(x3); x2=gdiv((GEN)x[2],x2); __ 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://hasse.mathematik.tu-muenchen.de/ntsw/pari/