Bill Allombert on Sat, 30 Oct 1999 20:26:07 +0200 (MET DST) |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: cotan() bug |
This patch corrects the following bugs: The CVS version has been updated. ? .5*O(3) *** bus error: bug in GP (please report). ? I*O(5) %1 = O(5)*I ? cos(%) %2 = 0.E-2495630 + 0.E-2495659*I ? cotan(I) *** division by zero in gdiv, gdivgs or ginv ? tan(I) *** division by zero in gdiv, gdivgs or ginv ?\ps2 seriesprecision = 2 significant terms ? cos(x+I) %3 = (0.E-28 + 0.E-28*I) + (0.E-28 + 0.E-28*I)*x + O(x^2) ? tan(1+I) %4 = -0.1797295366441293115045978048 + 1.381927396681501465499460288*I Now we get: ? .5*O(3) *** forbidden multiplication t_REAL * t_PADIC. ? I*O(5) %1 = O(5)*I ? cos(%) *** forbidden multiplication t_REAL * t_PADIC. ? cotan(I) %2 = 0.E-28 - 1.313035285499331303636161246*I ? tan(I) %3 = 0.E-29 + 0.7615941559557648881194582826*I ? \ps2 seriesprecision = 2 significant terms ? cos(x+I) %4 = (1.543080634815243778477905620 + 0.E-28*I) + (0.E-28 - 1.175201193643801456882381850*I)*x + O(x^2) ? tan(1+I) %5 = 0.2717525853195117165288437224 + 1.083923327338694543475752061*I The number of untested features of PARI is unbelievable. Index: src/basemath/gen1.c =================================================================== RCS file: /home/megrez/cvsroot/pari/src/basemath/gen1.c,v retrieving revision 1.4 diff -u -r1.4 gen1.c --- src/basemath/gen1.c 1999/10/21 09:51:07 1.4 +++ src/basemath/gen1.c 1999/10/30 18:08:02 @@ -964,7 +964,7 @@ l=avma; p1=co8(y,lg(x)); tetpil=avma; return gerepile(l,tetpil,gmul(p1,x)); - case t_INTMOD: err(gmulerf,tx,ty); + case t_PADIC: case t_INTMOD: err(gmulerf,tx,ty); } case t_INTMOD: Index: src/basemath/trans1.c =================================================================== RCS file: /home/megrez/cvsroot/pari/src/basemath/trans1.c,v retrieving revision 1.5 diff -u -r1.5 trans1.c --- src/basemath/trans1.c 1999/10/29 09:04:52 1.5 +++ src/basemath/trans1.c 1999/10/30 18:08:03 @@ -1340,8 +1340,8 @@ case t_COMPLEX: y=cgetg(3,t_COMPLEX); av=avma; r=gexp((GEN)x[2],prec); p1=ginv(r); - p2=gmul2n(mpadd(p1,r),-1); - p1=mpsub(p2,r); + p2=gmul2n(gadd(p1,r),-1); + p1=gsub(p2,r); gsincos((GEN)x[1],&u,&v,prec); tetpil=avma; y[1]=lmul(p2,v); y[2]=lmul(p1,u); @@ -1419,8 +1419,8 @@ case t_COMPLEX: y=cgetg(3,t_COMPLEX); av=avma; r=gexp((GEN)x[2],prec); p1=ginv(r); - p2=gmul2n(mpadd(p1,r),-1); - p1=mpsub(p2,p1); + p2=gmul2n(gadd(p1,r),-1); + p1=gsub(p2,p1); gsincos((GEN)x[1],&u,&v,prec); tetpil=avma; y[1]=lmul(p2,u); y[2]=lmul(p1,v); @@ -1506,12 +1506,12 @@ ps=cgetg(3,t_COMPLEX); pc=cgetg(3,t_COMPLEX); *s=ps; *c=pc; av=avma; r=gexp((GEN)x[2],prec); p1=ginv(r); - p2=gmul2n(mpadd(p1,r),-1); - p1=mpsub(p2,p1); r=mpsub(p2,r); + v1=gmul2n(gadd(p1,r),-1); + u1=gsub(v1,p1); r=gsub(v1,r);/*u1=I*sin(I*Im(x));v1=cos(I*Im(x));r=-u1*/ gsincos((GEN)x[1],&u,&v,prec); tetpil=avma; - p1=gmul(p2,u); p2=gmul(p1,v); - p3=gmul(p2,v); p4=gmul(r,u); + p1=gmul(v1,u); p2=gmul(u1,v); + p3=gmul(v1,v); p4=gmul(r,u); gptr[0]=&p1; gptr[1]=&p2; gptr[2]=&p3; gptr[3]=&p4; gerepilemanysp(av,tetpil,gptr,4); ps[1]=(long)p1; ps[2]=(long)p2; pc[1]=(long)p3; pc[2]=(long)p4;