Louis . Granboulan on Sat, 31 Jan 1998 17:34:30 +0100


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

Small patch concerning small bugs.


* In arith1.c (isprime_proto) avma may be restored too early.
* In bibli1.c (lindep) MAX may have been defined in some header file.
* In gp_rl.c  Extern declarations should be declared with "extern".

*** src/basemath/arith1.c     Sun Dec 14 16:32:00 1997
--- src/basemath/arith1.c     Thu Dec 18 16:31:14 1997
***************
*** 1321,1332 ****
  static long
  isprime_proto(GEN x,long k)
  {
!   long av=avma;
  
!   x=absi(x); avma=av;
!   if (gcmpgs(x,3)<=0) return !gcmp1(x);
!   if (!mpodd(x)) return 0;
!   return millerrabin(x,k);
  }
  
  GEN
--- 1321,1334 ----
  static long
  isprime_proto(GEN x,long k)
  {
!   long av=avma, res;
  
!   x=absi(x);
!   if (gcmpgs(x,3)<=0) { res = !gcmp1(x); avma=av; return res; }
!   if (!mpodd(x)) { avma=av; return 0; }
!   res = millerrabin(x,k);
!   avma=av;
!   return res;
  }
  
  GEN
*** src/basemath/bibli1.c     Mon Dec 15 22:47:28 1997
--- src/basemath/bibli1.c     Tue Dec 16 18:43:13 1997
***************
*** 1859,1877 ****
  }
  
  #define quazero(x) ( gcmp0(x) || ( typ(x)==t_REAL && expo(x) < EXP ) )
! #define MAX 50
  GEN
  lindep(GEN x, long prec)
  {
!   GEN b[MAX],be[MAX],bn[MAX],m[MAX][MAX],c1,c2,c3,px,py,pxy;
    GEN re,im,p3,p4,p5,p6,p7,r,f,em;
!   long qzer[MAX];
    long av1,tetpil,i,j,fl,i1;
    long av = avma, lx = lg(x), tx = typ(x), n = lx-1;
    const long EXP = - bit_accuracy(prec) + 2*n;
  
    if (! is_vec_t(tx)) err(typeer,"lindep");
!   if (lx>=MAX) err(talker,"more than 50 numbers in lindep");
    if (lx<=2) return cgetg(1,t_VEC);
    re=greal(x); im=gimag(x);
    px=sqscal(re); py=sqscal(im); pxy=gscal(re,im);
--- 1859,1879 ----
  }
  
  #define quazero(x) ( gcmp0(x) || ( typ(x)==t_REAL && expo(x) < EXP ) )
! #define MAXhastad 50
! #define ERRhastad "more than " #MAXhastad " numbers in lindep"
  GEN
  lindep(GEN x, long prec)
  {
!   GEN b[MAXhastad],be[MAXhastad],bn[MAXhastad],m[MAXhastad][MAXhastad],
!     c1,c2,c3,px,py,pxy;
    GEN re,im,p3,p4,p5,p6,p7,r,f,em;
!   long qzer[MAXhastad];
    long av1,tetpil,i,j,fl,i1;
    long av = avma, lx = lg(x), tx = typ(x), n = lx-1;
    const long EXP = - bit_accuracy(prec) + 2*n;
  
    if (! is_vec_t(tx)) err(typeer,"lindep");
!   if (lx>=MAXhastad) err(talker,ERRhastad);
    if (lx<=2) return cgetg(1,t_VEC);
    re=greal(x); im=gimag(x);
    px=sqscal(re); py=sqscal(im); pxy=gscal(re,im);
***************
*** 1962,1968 ****
    p4=gauss(gtrans(p5),p3); tetpil=avma;
    return gerepile(av,tetpil,gtrans(p4));
  }
! #undef MAX
  
  GEN
  algdep0(GEN x, long n, long bit, long prec)
--- 1964,1970 ----
    p4=gauss(gtrans(p5),p3); tetpil=avma;
    return gerepile(av,tetpil,gtrans(p4));
  }
! #undef MAXhastad
  
  GEN
  algdep0(GEN x, long n, long bit, long prec)
*** src/gp/gp_rl.c    Sun Dec 14 16:32:00 1997
--- src/gp/gp_rl.c    Tue Dec 16 18:16:29 1997
***************
*** 13,24 ****
  #ifdef READLINE
  BEGINEXTERN
  #include <readline.h>
! char **pari_completion(char *text, int start, int end);
! char *filename_completion_function(char *text,int state);
! char *username_completion_function(char *text,int state);
  
! int rl_completion_query_items;
! int rl_bind_key_in_map ();
  ENDEXTERN
  
  void print_fun_list(char **matches, int nbli);
--- 13,24 ----
  #ifdef READLINE
  BEGINEXTERN
  #include <readline.h>
! extern char **pari_completion(char *text, int start, int end);
! extern char *filename_completion_function(char *text,int state);
! extern char *username_completion_function(char *text,int state);
  
! extern int rl_completion_query_items;
! extern int rl_bind_key_in_map ();
  ENDEXTERN
  
  void print_fun_list(char **matches, int nbli);
-----------