Xavier Roblot on Wed, 20 Oct 1999 12:11:15 -0400


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

Re: Bug in nfabsis/Round4


Bill Allombert wrote:

> I stumble on this one, with the current cvs version:
> 
> ? nfbasis(x^16-42*x^12+560*x^10-1645*x^8+2352*x^6+10290*x^4+10192*x^2+3969)
>   ***   impossible inverse modulo: Mod(0, 2).

The bug was due to a possible lost of precision in one of the modular reductions
performed in nilord2. It is corrected using the following patch (I have also
updated the CVS version).

Xavier


Index: src/basemath/base2.c
===================================================================
RCS file: /home/megrez/cvsroot/pari/src/basemath/base2.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -c -r1.6 -r1.7
*** src/basemath/base2.c        1999/10/15 16:50:03     1.6
--- src/basemath/base2.c        1999/10/20 16:01:17     1.7
***************
*** 1704,1719 ****
          if (typ(delt) == t_INT)
          {
            chie = poleval(chig, gadd(polx[v], delt));
-           chie = polmodi(chie, pmr);
            nue  = (GEN)factmod(chie, p)[1];
            l    = lg(nue) - 1;
            nue  = lift((GEN)nue[l]);
          }
          else
!         {
            p1   = factcp(p, chi, eta);
            chie = (GEN)p1[1]; 
-           chie = polmodi(chie, pmr);
            nue  = (GEN)p1[2]; 
            l    = itos((GEN)p1[3]);
          }
--- 1704,1717 ----
          if (typ(delt) == t_INT)
          {
            chie = poleval(chig, gadd(polx[v], delt));
            nue  = (GEN)factmod(chie, p)[1];
            l    = lg(nue) - 1;
            nue  = lift((GEN)nue[l]);
          }
          else
!         { 
            p1   = factcp(p, chi, eta);
            chie = (GEN)p1[1]; 
            nue  = (GEN)p1[2]; 
            l    = itos((GEN)p1[3]);
          }
***************
*** 1731,1736 ****
--- 1729,1736 ----
        }
        delete_var();    
  
+       if (!signe(modii((GEN)chie[2], pmr))) chie = mycaract(chi, eta);
+ 
        pie = getprime(p, chi, eta, chie, nue, &Le, &Ee);
        if (Ea%Ee)
        {