summaryrefslogtreecommitdiff
path: root/sqrt.c
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2002-01-21 10:38:37 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2002-01-21 10:38:37 +0000
commitaf26e877b77943c658a3bdec03f554e7297333b6 (patch)
tree340449aae03fafa6a2b65cacbdc314fe6bceca52 /sqrt.c
parent8a7ab67d53367e71edb43970889b2a463a2354a1 (diff)
downloadmpfr-af26e877b77943c658a3bdec03f554e7297333b6.tar.gz
can_round type changed: char -> int.
Case sqrt(0) improved. git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@1664 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'sqrt.c')
-rw-r--r--sqrt.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/sqrt.c b/sqrt.c
index 5caf0c2cf..c673642ac 100644
--- a/sqrt.c
+++ b/sqrt.c
@@ -32,12 +32,12 @@ mpfr_sqrt (mpfr_ptr r, mpfr_srcptr u, mp_rnd_t rnd_mode)
mp_ptr up, rp, tmp, remp;
mp_size_t usize, rrsize;
mp_size_t rsize;
- mp_size_t prec, err;
+ mp_size_t err;
mp_limb_t q_limb;
long rw, nw, k;
int inexact = 0, t;
unsigned long cc = 0;
- char can_round = 0;
+ int can_round = 0;
TMP_DECL(marker0);
{
TMP_DECL (marker);
@@ -75,15 +75,11 @@ mpfr_sqrt (mpfr_ptr r, mpfr_srcptr u, mp_rnd_t rnd_mode)
MPFR_CLEAR_INF(r);
- prec = MPFR_PREC(r);
-
- if (!MPFR_NOTZERO(u))
- {
- MPFR_EXP(r) = 0;
- rsize = (prec-1)/BITS_PER_MP_LIMB + 1;
- MPN_ZERO(MPFR_MANT(r), rsize);
- return 0; /* zero is exact */
- }
+ if (MPFR_IS_ZERO(u))
+ {
+ MPFR_SET_ZERO(r);
+ MPFR_RET(0); /* zero is exact */
+ }
up = MPFR_MANT(u);
usize = (MPFR_PREC(u) - 1)/BITS_PER_MP_LIMB + 1;