summaryrefslogtreecommitdiff
path: root/mpfr-impl.h
diff options
context:
space:
mode:
authorthevenyp <thevenyp@280ebfd0-de03-0410-8827-d642c229c3f4>2009-01-21 14:25:33 +0000
committerthevenyp <thevenyp@280ebfd0-de03-0410-8827-d642c229c3f4>2009-01-21 14:25:33 +0000
commit0e115b190cf1af29e5418f8ecd5dca68b219d355 (patch)
treea395b94d7bd9ca5c42529337c83c08084a865fdb /mpfr-impl.h
parent7d08286e6d1213ec08b5790def89098eed473615 (diff)
downloadmpfr-0e115b190cf1af29e5418f8ecd5dca68b219d355.tar.gz
mpfr-impl.h: avoid a compiler bug under Mac OS X Tiger + Xcode (&x == &x
is false) that makes tset_d fail; this problem was introduced in r5880. [merged -c 5883 from trunk] git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/branches/2.4@5884 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'mpfr-impl.h')
-rw-r--r--mpfr-impl.h13
1 files changed, 8 insertions, 5 deletions
diff --git a/mpfr-impl.h b/mpfr-impl.h
index 2721d6d5e..9692ae5b9 100644
--- a/mpfr-impl.h
+++ b/mpfr-impl.h
@@ -407,18 +407,21 @@ typedef union ieee_double_extract Ieee_double_extract;
((((Ieee_double_extract *)&(x))->s.manl != 0) || \
(((Ieee_double_extract *)&(x))->s.manh != 0)))
#else
-/* Below, the &(x) == &(x) allows to make sure that x is a lvalue
- without (probably) any warning from the compiler. */
-# define DOUBLE_ISINF(x) (&(x) == &(x) && ((x) > DBL_MAX || (x) < -DBL_MAX))
+/* Below, the &(x) == &(x) || &(x) != &(x) allows to make sure that x
+ is a lvalue without (probably) any warning from the compiler. The
+ &(x) != &(x) is needed to avoid a failure under Mac OS X 10.4.11
+ (with Xcode 2.4.1, i.e. the latest one). */
+# define LVALUE(x) (&(x) == &(x) || &(x) != &(x))
+# define DOUBLE_ISINF(x) (LVALUE(x) && ((x) > DBL_MAX || (x) < -DBL_MAX))
# ifdef MPFR_NANISNAN
/* Avoid MIPSpro / IRIX64 / gcc -ffast-math (incorrect) optimizations.
The + must not be replaced by a ||. With gcc -ffast-math, NaN is
regarded as a positive number or something like that; the second
test catches this case. */
# define DOUBLE_ISNAN(x) \
- (&(x) == &(x) && !((((x) >= 0.0) + ((x) <= 0.0)) && -(x)*(x) <= 0.0))
+ (LVALUE(x) && !((((x) >= 0.0) + ((x) <= 0.0)) && -(x)*(x) <= 0.0))
# else
-# define DOUBLE_ISNAN(x) (&(x) == &(x) && (x) != (x))
+# define DOUBLE_ISNAN(x) (LVALUE(x) && (x) != (x))
# endif
#endif