This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH]: Integrate gfortran with MPC
On Tue, 19 May 2009, Steve Kargl wrote:
> > > Okay for mainline?
> > >
> > OK. Thanks for your MPFR/MPC work!
> No. The patch may not be correct, but I
> haven't had time to review it.
> In particular, Kaveh uses mpfr_get_default_prec to
> set the precision. I believe this should be
> mpfr_get_prec(re or im) depending on Fortran mix
> mode rules.
I did that on purpose. When I looked through the fortran frontend, it
appeared that the code sets the default mpfr precision to 128 in arith.c
and all of fortran's mpfr_t variables are initialized using the default
precision via mpfr_init(), i.e. not mpfr_init2().
Note: In particular, the existing hand-rolled mpfr code in there uses
mpfr_init() which uses the default precision for the intermediate
variables used in the calculations.
MPC has no default initializer, you have to pass in some precision. So
that's why I pulled out the default mpfr precision. It should match
whatever precision of the mpfr_t variables that were passed in.
If that's not the right thing to do, just let me know what you'd prefer
and I'll change it. For the intermediate mpc_t variable, I can use the
precision of the input re/im, or that of the result re/im, or the larger
of the two. Whatever you think makes sense. If the precision of the real
can be different than that of the imaginary part, let me know also.
Otherwise I'll assume they are the same.