summaryrefslogtreecommitdiff
path: root/set_str_raw.c
diff options
context:
space:
mode:
authorzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2002-03-25 14:56:28 +0000
committerzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2002-03-25 14:56:28 +0000
commit91f92d11d2b95e7378c3508f745a51fc96490d05 (patch)
treec933cafaa674f1ae0b70351321626f19d8d34810 /set_str_raw.c
parent29987ed67b81e0de840d96e39a655a99de6a3fc1 (diff)
downloadmpfr-91f92d11d2b95e7378c3508f745a51fc96490d05.tar.gz
MPFR_SIZE and sign were incorrectly set [thanks Kevin]
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@1771 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'set_str_raw.c')
-rw-r--r--set_str_raw.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/set_str_raw.c b/set_str_raw.c
index e36143221..3594a4774 100644
--- a/set_str_raw.c
+++ b/set_str_raw.c
@@ -40,8 +40,8 @@ mpfr_set_str_raw (mpfr_ptr x, char *str)
long expn = 0, e; char *endstr2;
xp = MPFR_MANT(x);
- xsize = 1 + (MPFR_PREC(x)-1)/BITS_PER_MP_LIMB;
- alloc = (strlen(str)+1) * sizeof(char);
+ xsize = 1 + (MPFR_PREC(x) - 1) / BITS_PER_MP_LIMB;
+ alloc = (strlen(str) + 1) * sizeof(char);
if (*str == '-')
{
@@ -102,7 +102,7 @@ mpfr_set_str_raw (mpfr_ptr x, char *str)
MPFR_SET_ZERO(x);
}
else {
- l = (l-1) / BITS_PER_MP_LIMB + 1;
+ l = (l - 1) / BITS_PER_MP_LIMB + 1;
str2 = str0;
if (l > xsize) {
@@ -115,7 +115,7 @@ mpfr_set_str_raw (mpfr_ptr x, char *str)
{
j = 0;
xp[xsize - k] = 0;
- while (str2<endstr2 && j < BITS_PER_MP_LIMB)
+ while ((str2 < endstr2) && (j < BITS_PER_MP_LIMB))
{
xp[xsize - k] = (xp[xsize - k] << 1) + (*str2 - '0');
str2++; j++;
@@ -129,7 +129,8 @@ mpfr_set_str_raw (mpfr_ptr x, char *str)
if (cnt) mpn_lshift(xp, xp, xsize, cnt);
MPFR_EXP(x) = expn - cnt;
- MPFR_SIZE(x) = xsize; if (negative) MPFR_CHANGE_SIGN(x);
+ if (MPFR_ISNEG(x) != negative)
+ MPFR_CHANGE_SIGN(x);
}
(*__gmp_free_func) (str0, alloc);