Bill Allombert on Fri, 12 Nov 1999 15:07:00 +0100 (MET)


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

bug of isinexactfield.


Hello,
There an obvious bug in isinexactfield.
? 1/Mod(1.8*x - 4, x^3 + 1)
  ***   bug in subresext, please report
? 1/Mod(1.8*x - 4.,x^3 + 1)
%20 = Mod(-0.04639706724710734333829762859*x^2 - 0.1031045938824607629739947302*x - 0.2291213197388016954977660671, x^3 + 1)

isinexactfield considers wrongly 1.8*x - 4 as an exact polynomial
since at least (!) one coefficient is exact , so subresext is used.

Here a patch:
(CVS version updated)
Index: src/basemath/polarit2.c
===================================================================
RCS file: /home/megrez/cvsroot/pari/src/basemath/polarit2.c,v
retrieving revision 1.3
diff -u -r1.3 polarit2.c
--- src/basemath/polarit2.c     1999/09/28 11:59:28     1.3
+++ src/basemath/polarit2.c     1999/11/12 13:54:38
@@ -1412,10 +1412,10 @@
     case t_REAL: case t_PADIC: case t_SER:
       return 1;
     case t_POL:
-      lx=lgef(x); if (lx == 2) return 0;
+      lx=lgef(x); if (lx == 2) return 0;/*true 0 polynomial*/
       for (i=2; i<lx; i++)
-       if (!isinexactfield((GEN)x[i])) return 0;
-      return 1;
+       if (isinexactfield((GEN)x[i])) return 1;
+      return 0;
     case t_COMPLEX: case t_POLMOD:
       return isinexactfield((GEN)x[1]) || isinexactfield((GEN)x[2]);
   }