Karim BELABAS on Thu, 18 Mar 1999 19:01:09 +0100 (MET)


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

Re: quadregulator() bug


[Igor:]
> this was introduced in 2.0.13:
> 
> ? quadregulator(15!-3)
>   ***   overflow in S*R

(newly introduced) garbage collecting overwritting an inconspicuous variable,
which is needed later on. Here's a patch.

Karim.

*** src/basemath/arith1.c.orig  Wed Mar 17 15:42:19 1999
--- src/basemath/arith1.c       Thu Mar 18 18:59:16 1999
***************
*** 1859,1867 ****
    sqd=racine(x); rsqd=gsqrt(x,prec);
    if (gegal(sqri(sqd),x)) err(talker,"square argument in regula");
  
-   av2=avma; lim = (av2+3*bot)>>2;
    rexp=gzero; reg=cgetr(prec); affsr(2,reg);
    ln2 = mplog(reg);
    a = shifti(addsi(r,sqd),-1);
    v = gdeux; u = stoi(r);
    for(;;)
--- 1859,1867 ----
    sqd=racine(x); rsqd=gsqrt(x,prec);
    if (gegal(sqri(sqd),x)) err(talker,"square argument in regula");
  
    rexp=gzero; reg=cgetr(prec); affsr(2,reg);
    ln2 = mplog(reg);
+   av2=avma; lim = (av2+3*bot)>>2;
    a = shifti(addsi(r,sqd),-1);
    v = gdeux; u = stoi(r);
    for(;;)
--
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/