This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [FORTRAN PATCH]: Use mpc_pow_z for (complex float ** int)
- From: Steve Kargl <sgk at troutmask dot apl dot washington dot edu>
- To: "Kaveh R. GHAZI" <ghazi at caip dot rutgers dot edu>
- Cc: fortran at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Wed, 7 Oct 2009 15:28:27 -0700
- Subject: Re: [FORTRAN PATCH]: Use mpc_pow_z for (complex float ** int)
- References: <Pine.GSO.4.58.0910071658020.8036@caipclassic.rutgers.edu>
On Wed, Oct 07, 2009 at 05:02:04PM -0400, Kaveh R. GHAZI wrote:
> The fortran frontend has special case code to handle constant folding of
> (complex real ** int). The existing MPC solution handles it by converting
> the integer exponent (an mpz_t) into a complex real (mpc_t) of the same
> size as the existing base argument and then calling mpc_pow to get the
> result.
>
> This patch updates it to use the new mpc_pow_z function. In addition to
> being more compact and simple on the GCC side, this change solves a
> potential problem. That is, when converting a very large int to a real it
> may not fit into the precision of that floating point number. The
> mpc_pow_z function takes this into account by accepting the raw mpz_t
> without conversion and handles it appropriately internally in the library.
>
> Tested on x86_64-unknown-linux-gnu without MPC, with mpc-0.7 and with
> mpc svn revision 701 (which has the new mpc_pow_z). No regressions.
>
> Okay for mainline?
>
OK.
--
Steve