Bill Allombert on Tue, 2 Nov 1999 16:21:50 +0100 (MET) |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: Bugs... |
Hello, I have fine-tuned my bug-finder prog. Here's one it found: (It use makeintmod and makepolmod functions that are in the prog.) ? a=makeintmod(4,-8) %2 = Mod(4, -8) ? b=makepolmod(473382145/-830485163*x^3,""*x^3) %3 = Mod(-473382145/830485163*x^3, ""*x^3) ? a/b and another without, ? 0.E-38 %1 = 0.E-66 ? Mod("%4?6"*x, -0.04992678105267275209800097860*x^2) %2 = Mod("%4?6"*x, -0.04992678105267275209800097860*x^2) ? %1/%2 *** bus error: bug in GP (please report). The patch correct 1)The first below. 2) "eee"/x *** segmentation fault: bug in GP (please report). 3) ? Mod(2, 7) %1 = Mod(2, 7) ? type(1/2,FRACN) %2 = 1/2 ? %1/%2 Session die.... Bill. CVS version updated. Index: src/basemath/gen1.c =================================================================== RCS file: /home/megrez/cvsroot/pari/src/basemath/gen1.c,v retrieving revision 1.6 diff -u -r1.6 gen1.c --- src/basemath/gen1.c 1999/11/01 20:03:06 1.6 +++ src/basemath/gen1.c 1999/11/02 15:04:57 @@ -1811,6 +1811,8 @@ if (ty == t_POLMOD) return gerepileupto(av, gdiv(to_polmod(x,(GEN)y[1]), y)); } + if (is_noncalc_t(tx) || is_noncalc_t(ty)) + err(typeer,"division"); /* now x and y are not both is_scalar_t */ lx = lg(x); Index: src/basemath/polarit1.c =================================================================== RCS file: /home/megrez/cvsroot/pari/src/basemath/polarit1.c,v retrieving revision 1.4 diff -u -r1.4 polarit1.c --- src/basemath/polarit1.c 1999/10/11 15:02:44 1.4 +++ src/basemath/polarit1.c 1999/11/02 15:04:57 @@ -150,7 +150,7 @@ p1[1]=lmul(x1,xx1); p1[2]=lmul(x2,xx2); return p1; } - +/*must NEVER returns a FRACN or a RFRACN*/ GEN gred(GEN x) { @@ -164,7 +164,7 @@ if (p1 == gzero) return y; /* gzero volontaire */ (void)new_chunk((lgefint(x1)+lgefint(x2))<<1); p1=mppgcd(x2,p1); - if (is_pm1(p1)) { avma=av; return gcopy(x); } + if (is_pm1(p1)) { avma=av; y=gcopy(x); settyp(y,t_FRAC); return y; } avma=av; y=cgetg(3,t_FRAC); y[1]=ldivii(x1,p1); y[2]=ldivii(x2,p1); return y; Index: src/headers/paritype.h =================================================================== RCS file: /home/megrez/cvsroot/pari/src/headers/paritype.h,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 paritype.h --- src/headers/paritype.h 1999/09/16 13:47:45 1.1.1.1 +++ src/headers/paritype.h 1999/11/02 15:04:57 @@ -53,3 +53,5 @@ #define needsnewline(tx) (is_matvec(tx)) #define isscalar(x) (is_scalar_t(typ(x)) || (typ(x)==t_POL && lgef(x)<=3)) #define isnonscalar(x) (typ(x) == t_POL && lgef(x) > 3) + +#define is_noncalc_t(tx) ((tx) >= t_LIST)