summaryrefslogtreecommitdiff
path: root/mpfr-impl.h
diff options
context:
space:
mode:
authorryde <ryde@280ebfd0-de03-0410-8827-d642c229c3f4>2003-01-25 00:20:07 +0000
committerryde <ryde@280ebfd0-de03-0410-8827-d642c229c3f4>2003-01-25 00:20:07 +0000
commit1500bee2462b3fa7ac50d314dbd880d31c36f727 (patch)
tree982dfe10b0ce5cfafaea3917482ebf1bf34425bb /mpfr-impl.h
parent54edfbf8718d039ea65211f7911375d2b9a84539 (diff)
downloadmpfr-1500bee2462b3fa7ac50d314dbd880d31c36f727.tar.gz
(LONGDOUBLE_NAN_ACTION): New macro.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@2226 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'mpfr-impl.h')
-rw-r--r--mpfr-impl.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/mpfr-impl.h b/mpfr-impl.h
index df4d7b30a..a974ad9dd 100644
--- a/mpfr-impl.h
+++ b/mpfr-impl.h
@@ -107,6 +107,26 @@ typedef union ieee_double_extract Ieee_double_extract;
#define DBL_NEG_INF (-1.0/0.0)
#define DBL_NAN (0.0/0.0)
+
+/* Execute the code "action" if x is a NaN.
+ Under IEEE rules, NaN is not equal to anything, including itself.
+ "volatile" here stops "cc" on mips64-sgi-irix6.5 from optimizing away
+ x!=x. */
+#define LONGDOUBLE_NAN_ACTION(x, action) \
+ do { \
+ volatile long double __x = LONGDOUBLE_VOLATILE (x); \
+ if ((x) != __x) \
+ { action; } \
+ } while (0)
+
+#ifdef volatile
+long double __gmpfr_longdouble_volatile __GMP_PROTO ((long double)) ATTRIBUTE_CONST;
+#define LONGDOUBLE_VOLATILE(x) (__gmpfr_longdouble_volatile (x))
+#else
+#define LONGDOUBLE_VOLATILE(x) (x)
+#endif
+
+
/* bit 31 of _mpfr_size is used for sign,
bit 30 of _mpfr_size is used for Nan flag,
bit 29 of _mpfr_size is used for Inf flag,