Bill Allombert on Thu, 27 Feb 2003 18:38:26 +0100

 Re: zetakinit() puzzle

```On Wed, Feb 26, 2003 at 07:30:24PM +0100, Karim BELABAS wrote:
> On Wed, 26 Feb 2003, Bill Allombert wrote:
> > On Wed, Feb 26, 2003 at 06:01:41PM +0100, Karim BELABAS wrote:
> >> Of course, we have the same kind of problems with exact t_COMPLEX and
> >
> > I suppose gsincos take care of t_COMPLEX ? t_QUAD are more tricky to handle.
>
> We still have all hyperbolic functions: cosh(I*x) = cos(x), and so on.

They use gexp() for complex entries that in turn use gsincos, so
there is no problems. By the way there is no hyperbolic cotangent !

> > Here a new patch (that still need to change the bench).
> >
> > Now, I wonder if mpsc_exact is an overkill. Should not
> > mpsc_exact(GEN x,long prec){return gadd(x,realzero(prec));}
> > be as good, and work for exact t_QUAD as well ?
>
> As a matter of fact, it should!

OK, so here a new patch:

Index: src/basemath/trans1.c
===================================================================
RCS file: /home/megrez/cvsroot/pari/src/basemath/trans1.c,v
retrieving revision 1.81
diff -u -r1.81 trans1.c
--- src/basemath/trans1.c	2003/01/15 20:46:02	1.81
+++ src/basemath/trans1.c	2003/02/27 16:42:48
@@ -1827,6 +1827,12 @@
gerepilemanyvec(av,tetpil,y+1,2);
return y;

+    case t_INT: case t_FRAC: case t_FRACN:
+      p1=cgetr(prec); av=avma;
+      affrr(mpcos(p2),p1); avma=av;
+      return p1;
+

default:
@@ -1900,6 +1906,12 @@
y[2]=lmul(p1,v);
gerepilemanyvec(av,tetpil,y+1,2);
return y;
+
+    case t_INT: case t_FRAC: case t_FRACN:
+      p1=cgetr(prec); av=avma;
+      affrr(mpsin(p2),p1); avma=av;
+      return p1;

@@ -1979,9 +1991,11 @@
switch(typ(x))
{
case t_INT: case t_FRAC: case t_FRACN:
-      av=avma; p1=cgetr(prec); gaffect(x,p1); tetpil=avma;
-      mpsincos(p1,s,c); gptr[0]=s; gptr[1]=c;
-      gerepilemanysp(av,tetpil,gptr,2);
+      *s=cgetr(prec); *c=cgetr(prec); av=avma;
+      mpsincos(p1,&ps,&pc);
+      affrr(ps,*s); affrr(pc,*c);
+      avma=av;
return;

case t_REAL:
@@ -2098,6 +2112,12 @@
av = avma; gsincos(x,&s,&c,prec);
return gerepileupto(av, gdiv(s,c));

+    case t_INT: case t_FRAC: case t_FRACN:
+      s=cgetr(prec); av=avma;
+      affrr(mptan(c),s); avma=av;
+      return s;
+

default:
@@ -2144,6 +2164,12 @@
case t_COMPLEX:
av = avma; gsincos(x,&s,&c,prec);
return gerepileupto(av, gdiv(c,s));
+
+    case t_INT: case t_FRAC: case t_FRACN:
+      s=cgetr(prec); av=avma;