summaryrefslogtreecommitdiff
path: root/set_d.c
diff options
context:
space:
mode:
authorpelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4>2004-09-20 14:45:32 +0000
committerpelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4>2004-09-20 14:45:32 +0000
commitd10329556c3b664495584896df408970b3869a59 (patch)
tree96f0814c3af7c2099128065b2f94acca4219f6bb /set_d.c
parentd6b32be3cf7fcc0c3ee0adffb41f77b787f44552 (diff)
downloadmpfr-d10329556c3b664495584896df408970b3869a59.tar.gz
Add ICC detection && support.
Remove some potential warnings in the test files. git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@2977 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'set_d.c')
-rw-r--r--set_d.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/set_d.c b/set_d.c
index d2d863c10..b9c3cba0d 100644
--- a/set_d.c
+++ b/set_d.c
@@ -159,7 +159,13 @@ mpfr_set_d (mpfr_ptr r, double d, mp_rnd_t rnd_mode)
MPFR_CLEAR_FLAGS(r);
- if (MPFR_UNLIKELY(d == 0))
+
+ if (MPFR_UNLIKELY(DOUBLE_ISNAN(d)))
+ {
+ MPFR_SET_NAN(r);
+ MPFR_RET_NAN;
+ }
+ else if (MPFR_UNLIKELY(d == 0))
{
#if _GMP_IEEE_FLOATS
union ieee_double_extract x;
@@ -172,7 +178,7 @@ mpfr_set_d (mpfr_ptr r, double d, mp_rnd_t rnd_mode)
else
MPFR_SET_POS(r);
#else /* _GMP_IEEE_FLOATS */
- MPFR_SET_ZERO(r);
+ MPFR_SET_ZERO(r);
{
/* This is to get the sign of zero on non-IEEE hardware
Some systems support +0.0, -0.0 and unsigned zero.
@@ -190,13 +196,8 @@ mpfr_set_d (mpfr_ptr r, double d, mp_rnd_t rnd_mode)
#endif
return 0; /* 0 is exact */
}
- else if (MPFR_UNLIKELY(DOUBLE_ISNAN(d)))
- {
- MPFR_SET_NAN(r);
- MPFR_RET_NAN;
- }
else if (MPFR_UNLIKELY(DOUBLE_ISINF(d)))
- {
+ {
MPFR_SET_INF(r);
if (d > 0)
MPFR_SET_POS(r);
@@ -259,3 +260,6 @@ mpfr_set_d (mpfr_ptr r, double d, mp_rnd_t rnd_mode)
return mpfr_check_range (r, inexact, rnd_mode);
}
+
+
+