Jeroen Demeyer on Wed, 12 Feb 2014 22:58:54 +0100


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

Patch for polcyclo_eval()


commit e33b86a948bb07792a721d187c3ac02bd98d9aca
Author: Jeroen Demeyer <jdemeyer@cage.ugent.be>
Date:   Wed Feb 12 22:55:13 2014 +0100

    Fix sign of polcyclo_eval(n, x) where x == -1 and typ(x) != t_INT

diff --git a/src/basemath/bibli2.c b/src/basemath/bibli2.c
index 587ff13..1642e2c 100644
--- a/src/basemath/bibli2.c
+++ b/src/basemath/bibli2.c
@@ -360,7 +360,7 @@ polcyclo_eval(long n, GEN x)
       if (l == 1) return gerepileupto(av, gmulgs(x,n));
       return gerepilecopy(av, x); /* else 1 */
     }
-    if (gequalm1(x)) return gerepilecopy(av, x); /* -1 */
+    if (gequalm1(x)) return gerepilecopy(av, gneg(x)); /* return -x = 1 */
   }
   /* Heuristic: evaluation will probably not improve things */
   if (tx == t_POL || tx == t_MAT || lg(x) > n)