Bill Allombert on Sun, 24 Jul 2011 00:11:28 +0200 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: znlog() behavior |
On Wed, Jul 20, 2011 at 03:31:53PM +0200, Max Alekseyev wrote: > And here is another bug, isn't it? > > ? znlog(6,Mod(2,7),znorder(Mod(2,7))) > %2 = 1 Sort of. (The code actually returns 3\2, see the attached patch which fix this issue). The problem is that there is no interfaces for reporting "no solution". For example: ? znlog(2,Mod(4,17),znorder(Mod(4,17))) *** at top-level: znlog(2,Mod(4,17),zn *** ^-------------------- *** znlog: gen_Shanks_log: supplied order (= 2) is incorrect. but the supplied order is actually correct. Maybe we should just do pari_err(consister,"gen_Shanks_log") instead. Cheers, Bill.
diff --git a/src/basemath/arith1.c b/src/basemath/arith1.c index 6fc986d..01df34a 100644 --- a/src/basemath/arith1.c +++ b/src/basemath/arith1.c @@ -2104,6 +2104,7 @@ _Fp_easylog(void *E, GEN x, GEN g, GEN ord) { ord = dlog_get_ord(ord); if (!ord) ord = p1; + if (mpodd(ord)) pari_err(consister,"Fp_log"); return gerepileupto(av, shifti(ord,-1)); } avma = av; return NULL;