diff options
author | Andreas Enge <andreas.enge@inria.fr> | 2012-03-07 10:15:17 +0000 |
---|---|---|
committer | Andreas Enge <andreas.enge@inria.fr> | 2012-03-07 10:15:17 +0000 |
commit | 42f34d3ca8c17e8146ddceea584a7b9b99577cf7 (patch) | |
tree | 43eebd1eb0e4abe7deef2953f0145fa9162aac5d /src/sqr.c | |
parent | 5d70ba51e4da3dcd57f4184b7a2cf9a5fc2ef2f0 (diff) | |
download | mpc-git-42f34d3ca8c17e8146ddceea584a7b9b99577cf7.tar.gz |
sqr.c: small changes to drop goto
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/mpc/trunk@1141 211d60ee-9f03-0410-a15a-8952a2c7a4e4
Diffstat (limited to 'src/sqr.c')
-rw-r--r-- | src/sqr.c | 33 |
1 files changed, 18 insertions, 15 deletions
@@ -287,25 +287,29 @@ mpc_sqr (mpc_ptr rop, mpc_srcptr op, mpc_rnd_t rnd) and we round up, an overflow will give +Inf, but an underflow will give 0.5*2^emin */ if (mpfr_get_exp (u) == emin) /* underflow */ - { + { inex_re = mpfr_fsss (rop->re, x, op->im, MPC_RND_RE (rnd)); - goto end_of_real_part; - } + ok = 1; + } else if (mpfr_inf_p (u)) - { + { /* let mpc_realref(rop) be a "correctly rounded overflow" */ - inex_re = mpfr_set_ui_2exp (mpc_realref (rop), 1, emax, MPC_RND_RE (rnd)); - break; - } - ok = (!inexact) | mpfr_can_round (u, prec - 3, GMP_RNDU, GMP_RNDZ, - MPC_PREC_RE (rop) + (MPC_RND_RE (rnd) == GMP_RNDN)); - if (ok) + inex_re = mpfr_set_ui_2exp (mpc_realref (rop), 1, emax, + MPC_RND_RE (rnd)); + ok = 1; + } + else { + ok = (!inexact) | mpfr_can_round (u, prec - 3, + GMP_RNDU, GMP_RNDZ, + MPC_PREC_RE (rop) + (MPC_RND_RE (rnd) == GMP_RNDN)); + if (ok) { - inex_re = mpfr_set (mpc_realref (rop), u, MPC_RND_RE (rnd)); - if (inex_re == 0) - /* remember that u was already rounded */ - inex_re = inexact; + inex_re = mpfr_set (mpc_realref (rop), u, MPC_RND_RE (rnd)); + if (inex_re == 0) + /* remember that u was already rounded */ + inex_re = inexact; } + } } else { @@ -351,7 +355,6 @@ mpc_sqr (mpc_ptr rop, mpc_srcptr op, mpc_rnd_t rnd) } while (!ok); - end_of_real_part: mpfr_clear (u); mpfr_clear (v); } |