summaryrefslogtreecommitdiff
path: root/set_d.c
diff options
context:
space:
mode:
authorpelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4>2003-10-27 15:15:04 +0000
committerpelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4>2003-10-27 15:15:04 +0000
commit734c0a144b04e2cae4e67b394010e3f6e3cadecc (patch)
treee0bb801e56a43c3aebe1ad73851ede3588e082fb /set_d.c
parenta7f45009dff2e3d0e8698b44e45f5cacacb82cdd (diff)
downloadmpfr-734c0a144b04e2cae4e67b394010e3f6e3cadecc.tar.gz
Change the internal format of MPFR: ZERO, INF and NAN have special values of exp.
Rename MPFR_ESIZE in MPFR_LIMB_SIZE. Rename MPFR_ABSZISE in MPFR_ALLOC_SIZE. Rename MPFR_INIT in MPFR_TMP_INIT (INIT1 too). "mpfr.h" includes <gmp.h> if GMP isn't detected. Change the way of detecting stdio.h (To check). Use mpfr namespace for new definitions in "mpfr.h". git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@2524 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'set_d.c')
-rw-r--r--set_d.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/set_d.c b/set_d.c
index a6fa6bf42..7e5672b14 100644
--- a/set_d.c
+++ b/set_d.c
@@ -188,8 +188,10 @@ mpfr_set_d (mpfr_ptr r, double d, mp_rnd_t rnd_mode)
else if (DOUBLE_ISINF(d))
{
MPFR_SET_INF(r);
- if ((d > 0 && (MPFR_SIGN(r) == -1)) || (d < 0 && (MPFR_SIGN(r) == 1)))
- MPFR_CHANGE_SIGN(r);
+ if (d > 0)
+ MPFR_SET_POS(r);
+ else
+ MPFR_SET_NEG(r);
return 0; /* infinity is exact */
}
@@ -198,9 +200,9 @@ mpfr_set_d (mpfr_ptr r, double d, mp_rnd_t rnd_mode)
would have same precision in the mpfr_set4 call below. */
MPFR_MANT(tmp) = tmpmant;
MPFR_PREC(tmp) = IEEE_DBL_MANT_DIG;
- MPFR_SIZE(tmp) = MPFR_LIMBS_PER_DOUBLE;
+ /*MPFR_SIZE(tmp) = MPFR_LIMBS_PER_DOUBLE;*/
- signd = (d < 0) ? -1 : 1;
+ signd = (d < 0) ? MPFR_SIGN_NEG : MPFR_SIGN_POS;
d = ABS (d);
MPFR_SET_EXP(tmp, __mpfr_extract_double (tmpmant, d));