summaryrefslogtreecommitdiff
path: root/mpfr-impl.h
diff options
context:
space:
mode:
Diffstat (limited to 'mpfr-impl.h')
-rw-r--r--mpfr-impl.h17
1 files changed, 12 insertions, 5 deletions
diff --git a/mpfr-impl.h b/mpfr-impl.h
index 4cc131504..0d2c41124 100644
--- a/mpfr-impl.h
+++ b/mpfr-impl.h
@@ -262,6 +262,16 @@ typedef unsigned long int mpfr_uexp_t;
#endif
#define MPFR_LIMBS_PER_DOUBLE ((IEEE_DBL_MANT_DIG-1)/BITS_PER_MP_LIMB+1)
+/* Visual C++ doesn't support +1.0/.00, -1.0/0.0 and 0.0/0.0
+#if defined(_MSC_VER) && defined(_WIN32) && (_MSC_VER >= 1200)
+# define DBL_POS_INF ((double)0x7ff0000000000000ull)
+# define DBL_NEG_INF ((double)0xfff0000000000000ull)
+# define DBL_NAN ((double)0x7ff8000000000000ull)
+#else */
+#define DBL_POS_INF ((double) 1.0/0.0)
+#define DBL_NEG_INF ((double)-1.0/0.0)
+#define DBL_NAN ((double) 0.0/0.0)
+
/* for x of type ieee_double_extract */
#if _GMP_IEEE_FLOATS
typedef union ieee_double_extract Ieee_double_extract;
@@ -274,13 +284,10 @@ typedef union ieee_double_extract Ieee_double_extract;
((((Ieee_double_extract *)&(x))->s.manl != 0) || \
(((Ieee_double_extract *)&(x))->s.manh != 0)))
#else
-# define DOUBLE_ISINF(x) (((x)==((double)+1.0/0.0))||((x)==((double)-1.0/0.0)))
-# define DOUBLE_ISNAN(x) ((x)!=(x))
+# define DOUBLE_ISINF(x) ((x) > DBL_MAX || (x) < -DBL_MAX)
+# define DOUBLE_ISNAN(x) ((x) != (x))
#endif
-#define DBL_POS_INF (1.0/0.0)
-#define DBL_NEG_INF (-1.0/0.0)
-#define DBL_NAN (0.0/0.0)
/* macros for long doubles */