Himanshu Jain on Tue, 04 Dec 2007 23:13:53 +0100


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

Can PARI use GNU MP integers and rationals?


Hi everybody,

I am new to PARI/GP. The problem I am working
on contains numbers in GNU MP format. I need to use
the PARI library as well.

Is there some way of converting  GNU MP types mpz_t,
mpq_t to t_INT, t_FRAC using PARI library
routines.

Some solutions I have in mind: first convert mpz_t to usual C
type say signed long  and then convert that to t_INT. This may not
always work if the original mpz_t is large. Another idea is to convert
mpz_t to char* and then use gp_read_stream to obtain a GEN type.

Are there better solutions?

Thank you,
Himanshu