| Karim Belabas on Tue, 30 Jul 2019 00:35:05 +0200 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
| Re: real/imag for t_QUAD |
* Vincent Delecroix [2019-07-30 00:28]:
> Le 30/07/2019 à 00:25, Bill Allombert a écrit :
> > On Tue, Jul 30, 2019 at 12:14:17AM +0200, Vincent Delecroix wrote:
> > > Thanks Karim and Bill for your replies! I did not look further than
> > > the simple '?real' and '?imag'.
> > >
> > > Now, the real question: how can I convert a t_QUAD to a t_COMPLEX (in
> > > the usual sense) with the pari library? greal/real_i and gimag/imag_i
> > > have the same behavior as in GP.
> >
> > Multiply by '1.'.
> >
> > ? quadgen(-23)*1.
> > %1 =
> > 0.50000000000000000000000000000000000000+2.3979157616563597707987190320813469600*I
> >
> > But the real question is why do you want to use t_QUAD ?
>
> I don't want to use it. I am working on cypari2. I want to fix the
> conversion of GEN to Python complex number (double floating point
> precision). This used to rely on real_i/imag_i and the question is
> how should I deal with t_QUAD properly?
x = quadtofp(x, DEFAULTPREC);
and then you have an ordinary complex number (possibly real or even rational)
to worry about.
Cheers,
K.B.
--
Karim Belabas, IMB (UMR 5251) Tel: (+33) (0)5 40 00 26 17
Universite de Bordeaux Fax: (+33) (0)5 40 00 21 23
351, cours de la Liberation http://www.math.u-bordeaux.fr/~kbelabas/
F-33405 Talence (France) http://pari.math.u-bordeaux.fr/ [PARI/GP]
`