Bill Allombert on Thu, 18 Mar 2010 10:39:44 +0100


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

Re: Degree overflow in pow_monome - PARI


On Wed, Mar 17, 2010 at 09:32:37PM -0500, Phat Tran wrote:
> ***   degree overflow in pow_monome.
>   ***   Error in the PARI system. End of program.
> 
> I got the error message above while running the codes in C using PARI/GP
> 2.3.5 under cygwin.
> 
>     GEN m = readseq("123456789");
> >     GEN n = readseq("1234567");
> >
> >     GEN a = readseq("7");
> >     GEN c = readseq("8");
> >
> >     GEN b = readseq("10358");
> >     GEN d = readseq("49850");
> >
> >
> >     GEN x = pol_x[fetch_user_var("x")];
> >     GEN y = pol_x[fetch_user_var("y")];
> >     GEN z = pol_x[fetch_user_var("a")];
> >
> >     z = gpowgs(gmodulo(gadd(x, gmodulo(gadd(y, gmodulss(1, n)),
> > gsub(gpowgs(y, c), d))), gsub(gpowgs(x, a), b)), m);

Hello Minhphat,

If you compile that code with gcc -Wall, you get warning:

phat.c:19: warning: passing argument 2 of ïgmodulssï makes integer from pointer
without a cast
phat.c:20: warning: passing argument 2 of ïgpowgsï makes integer from pointer without a cast
phat.c:20: warning: passing argument 2 of ïgpowgsï makes integer from pointer without a cast
phat.c:20: warning: passing argument 2 of ïgpowgsï makes integer from pointer without a cast

The problem is that you are calling functions that expect long int with a GEN
argument. This cannot work.

For example: gmodulss(1, n) expect two "long int" but n is a GEN.
idem for gpowgs.

Cheers,
Bill.