Karim BELABAS on Mon, 18 Jan 1999 18:42:28 +0100 (MET)


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

Re: nf.sign in 2.0.12


[Ilya wrote:]
> Since I cannot compile 2.0.13 - neither with cc, nor with gcc - I
> report a bug in 2.0.12.
> 
> ? res=-23708160*x^9 - 225566208*x^8 - 1131314688*x^7 - 3968372736*x^6 -
> 7276863 744*x^5 - 1112932224*x^4 + 22694392512*x^3 + 49279399488*x^2 +
> 50845741200*x + 22483386864
> %1 = -23708160*x^9 - 225566208*x^8 - 1131314688*x^7 - 3968372736*x^6 -
> 727686374 4*x^5 - 1112932224*x^4 + 22694392512*x^3 + 49279399488*x^2 +
> 50845741200*x + 224 83386864
> ? nf=nfinit(res);
>   ***   Warning: non-monic polynomial. I shall transform it.
> ? nf.sign
>   ***   incorrect type in .sign: nf.sign
> 
> (I also got a segfault when execution the same later in a long session.)

It's not exactly a bug: since the defining polynomial had to be changed, the
output is not a real "nf" since it also gives the transformation. But I guess
it doesn't hurt to support that format also. 

[Beware that most PARI functions which expect a number field won't
recognize that format: since we changed user's data behind his back, it looks
better to have user acknowledge the fact and do nf = nf[1] himself, if he
doesn't care about the transform.]

  Karim.

*** src/basemath/base1.c.orig   Tue Dec 15 21:51:37 1998
--- src/basemath/base1.c        Mon Jan 18 18:35:40 1999
***************
*** 103,108 ****
--- 103,111 ----
      case t_VEC:
        switch(lg(x))
        {
+         case 3:
+           if (typ(x[2]) != t_POLMOD) break;
+           return get_bnf((GEN)x[1],t);
          case 6 : *t = typ_QUA; return NULL;
          case 10: *t = typ_NF; return NULL;
          case 11: *t = typ_BNF; return x;
***************
*** 131,136 ****
--- 134,142 ----
      case t_VEC:
        switch(lg(x))
        {
+         case 3: 
+           if (typ(x[2]) != t_POLMOD) break;
+           return get_nf((GEN)x[1],t);
          case 10: *t = typ_NF; return x;
          case 11: *t = typ_BNF;
            x = (GEN)x[7]; if (typ(x)!=t_VEC || lg(x)!=10) break;


--
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://pari.home.ml.org