Vincent Torri on Thu, 09 Jun 2005 16:40:16 +0200 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: dumb question about rationals |
On Thu, 9 Jun 2005, Bill Allombert wrote:
On Thu, Jun 09, 2005 at 02:20:33PM +0200, Vincent Torri wrote:Hello, my program is almost working. But in some cases, i got the error message: impossible assignment I-->SThis mean you try to convert (with itos) a PARI object to a C long integer and either the object is not a PARI integer, or it is too large to fit in a signed long.
i've not thought about a too lage integer. I'll check that. There is no way to get a long long ? only long ?
Please use symbolic name for type (4=t_FRAC, 1=t_INT, etc.)
ok
Another question: What i do is the following : 1) I allocate 2 arrays of GEN (with malloc), say t1, t2 2) I init the 2 arrays 3) I do my stuff (a loop) : a) i fill t2 with modified values of t1 b) t1 = t2 (i do a loop on k : t1[k] = t2[k]) 4) store the values of t1, at the end of the loop 5) I free the 2 arrays. Could the problem above (it appears in step 4) arise from the fact that I use allocated arrays and I'm doing step 3)b) ? Should I use PARI vector instead of arraysUsually it is simpler to use PARI vector allocated in the stack than using malloc, though there are exceptions. If you do GEN *T=(GEN*)malloc(1000,sizeof(GEN)) for(i=0;i<1000;i++) T[i]=stoi(i) then T is actually an array of pointer to objects stored in the PARI stack. If you gerepile() the stack, T will not be updated and element of T will point to random data.
I've experienced that :) So I removed my garbge collector stuff :) Thank you for your answers Vincent Torri