From c351c2c6e45588cf61ead29d6cd8b832d6e05ff2 Mon Sep 17 00:00:00 2001 From: thevenyp Date: Mon, 2 Dec 2013 17:46:05 +0000 Subject: [tests/] Cosmetic changes. git-svn-id: svn://scm.gforge.inria.fr/svn/mpc/branches/benchs_tests@1351 211d60ee-9f03-0410-a15a-8952a2c7a4e4 --- tests/tgeneric.tpl | 88 ++++++++++++++++++++++++++---------------------------- 1 file changed, 43 insertions(+), 45 deletions(-) diff --git a/tests/tgeneric.tpl b/tests/tgeneric.tpl index 447c415..120dea3 100644 --- a/tests/tgeneric.tpl +++ b/tests/tgeneric.tpl @@ -302,52 +302,50 @@ random_params (mpc_fun_param_t *params, static int double_rounding_mpc (mpc_ptr lowprec, mpc_ptr hiprec, int inex, mpc_rnd_t rnd) { - /* reference value in high precision */ - mpfr_ptr hiprec_re = mpc_realref (hiprec); - mpfr_ptr hiprec_im = mpc_imagref (hiprec); - mpfr_exp_t hiprec_err_re; - mpfr_exp_t hiprec_err_im; - /* destination precision and rounding mode */ - mpfr_rnd_t lowprec_rnd_re = MPC_RND_RE (rnd); - mpfr_rnd_t lowprec_rnd_im = MPC_RND_IM (rnd); - mpfr_prec_t lowprec_prec_re = MPC_PREC_RE (lowprec); - mpfr_prec_t lowprec_prec_im = MPC_PREC_IM (lowprec); - - /* real hiprec error is bounded by one ulp */ - hiprec_err_re = MPC_PREC_RE (hiprec) - 1; - hiprec_err_im = MPC_PREC_IM (hiprec) - 1; - - if (MPC_RND_RE (rnd) == MPFR_RNDN) - /* when rounding to nearest, use the trick for determining the - correct ternary value which is described in MPFR - documentation */ - { - hiprec_err_re++; /* error is bounded by one half-ulp */ - lowprec_rnd_re = MPFR_RNDZ; - lowprec_prec_re++; - } - if (MPC_RND_IM (rnd) == MPFR_RNDN) - /* same trick as above */ - { - hiprec_err_im++; - lowprec_rnd_im = MPFR_RNDZ; - lowprec_prec_im++; - } + /* reference value in high precision */ + mpfr_ptr hiprec_re = mpc_realref (hiprec); + mpfr_ptr hiprec_im = mpc_imagref (hiprec); + mpfr_exp_t hiprec_err_re; + mpfr_exp_t hiprec_err_im; + /* destination precision and rounding mode */ + mpfr_rnd_t lowprec_rnd_re = MPC_RND_RE (rnd); + mpfr_rnd_t lowprec_rnd_im = MPC_RND_IM (rnd); + mpfr_prec_t lowprec_prec_re = MPC_PREC_RE (lowprec); + mpfr_prec_t lowprec_prec_im = MPC_PREC_IM (lowprec); + + /* real hiprec error is bounded by one ulp */ + hiprec_err_re = MPC_PREC_RE (hiprec) - 1; + hiprec_err_im = MPC_PREC_IM (hiprec) - 1; + + if (MPC_RND_RE (rnd) == MPFR_RNDN) + /* when rounding to nearest, use the trick for determining the + correct ternary value which is described in MPFR + documentation */ + { + hiprec_err_re++; /* error is bounded by one half-ulp */ + lowprec_rnd_re = MPFR_RNDZ; + lowprec_prec_re++; + } + if (MPC_RND_IM (rnd) == MPFR_RNDN) + /* same trick as above */ + { + hiprec_err_im++; + lowprec_rnd_im = MPFR_RNDZ; + lowprec_prec_im++; + } - return ((mpfr_nan_p (hiprec_re) - || mpfr_zero_p (hiprec_re) - || mpfr_inf_p (hiprec_re) - || MPC_INEX_RE (inex) == 0 - || mpfr_can_round (hiprec_re, hiprec_err_re, - MPC_RND_RE (rnd), - lowprec_rnd_re, lowprec_prec_re)) - && (mpfr_nan_p (hiprec_im) - || mpfr_zero_p (hiprec_im) - || mpfr_inf_p (hiprec_im) - || MPC_INEX_IM (inex) == 0 - || mpfr_can_round (hiprec_im, hiprec_err_im, - MPC_RND_IM (rnd), - lowprec_rnd_im, lowprec_prec_im))); + return ((mpfr_nan_p (hiprec_re) + || mpfr_zero_p (hiprec_re) + || mpfr_inf_p (hiprec_re) + || MPC_INEX_RE (inex) == 0 + || mpfr_can_round (hiprec_re, hiprec_err_re, MPC_RND_RE (rnd), + lowprec_rnd_re, lowprec_prec_re)) + && (mpfr_nan_p (hiprec_im) + || mpfr_zero_p (hiprec_im) + || mpfr_inf_p (hiprec_im) + || MPC_INEX_IM (inex) == 0 + || mpfr_can_round (hiprec_im, hiprec_err_im, MPC_RND_IM (rnd), + lowprec_rnd_im, lowprec_prec_im))); } /* check whether double rounding occurs; if not, round extra precise output -- cgit v1.2.1