This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH INSTALLED]: Fix MPC buglet in rounding type.


Minor gnit in the MPC code, we need two separate rounding types.  One is
the MPFR style type and one is the MPC style type, each is used in
different function calls depending on what type of variable we're
operating on.

Tested with MPC active, no regressions.

Installed on mainline as "obvious".

		--Kaveh


2009-05-18  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* builtins.c (do_mpc_arg1): Separate MPFR/MPC C rounding types.

diff -rup orig/egcc-SVN20090518/gcc/builtins.c egcc-SVN20090518/gcc/builtins.c
--- orig/egcc-SVN20090518/gcc/builtins.c	2009-05-16 02:01:58.000000000 +0200
+++ egcc-SVN20090518/gcc/builtins.c	2009-05-18 21:11:31.000000000 +0200
@@ -13671,6 +13671,7 @@ do_mpc_arg1 (tree arg, tree type, int (*
 	    REAL_MODE_FORMAT (TYPE_MODE (TREE_TYPE (type)));
 	  const int prec = fmt->p;
 	  const mp_rnd_t rnd = fmt->round_towards_zero ? GMP_RNDZ : GMP_RNDN;
+	  const mpc_rnd_t crnd = fmt->round_towards_zero ? MPC_RNDZZ : MPC_RNDNN;
 	  int inexact;
 	  mpc_t m;

@@ -13678,7 +13679,7 @@ do_mpc_arg1 (tree arg, tree type, int (*
 	  mpfr_from_real (MPC_RE(m), re, rnd);
 	  mpfr_from_real (MPC_IM(m), im, rnd);
 	  mpfr_clear_flags ();
-	  inexact = func (m, m, rnd);
+	  inexact = func (m, m, crnd);
 	  result = do_mpc_ckconv (m, type, inexact);
 	  mpc_clear (m);
 	}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]