isnanl[-nolibm]: Fix for platforms where 'long double' == 'double'.
authorBruno Haible <bruno@clisp.org>
Sun, 9 Oct 2011 10:14:12 +0000 (12:14 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 9 Oct 2011 10:14:12 +0000 (12:14 +0200)
* lib/isnan.c (rpl_isnanl): Don't blindly assume 80-bit 'long double'.
* m4/isnanl.m4 (gl_PREREQ_ISNANL): Require gl_LONG_DOUBLE_VS_DOUBLE.
(gl_FUNC_ISNANL_WORKS): Likewise. Don't blindly assume 80-bit
'long double'.
* modules/isnanl-nolibm (Files): Add m4/math_h.m4.

ChangeLog
lib/isnan.c
m4/isnanl.m4
modules/isnanl-nolibm

index 1851d72..52c523c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2011-10-09  Bruno Haible  <bruno@clisp.org>
 
+       isnanl[-nolibm]: Fix for platforms where 'long double' == 'double'.
+       * lib/isnan.c (rpl_isnanl): Don't blindly assume 80-bit 'long double'.
+       * m4/isnanl.m4 (gl_PREREQ_ISNANL): Require gl_LONG_DOUBLE_VS_DOUBLE.
+       (gl_FUNC_ISNANL_WORKS): Likewise. Don't blindly assume 80-bit
+       'long double'.
+       * modules/isnanl-nolibm (Files): Add m4/math_h.m4.
+
        isinf: Fix for platforms where 'long double' == 'double'.
        * m4/isinf.m4 (gl_ISINFL_WORKS): Require gl_LONG_DOUBLE_VS_DOUBLE.
        Don't blindly assume 80-bit 'long double'.
index f26dc1e..1d0754c 100644 (file)
@@ -83,7 +83,7 @@ int
 FUNC (DOUBLE x)
 {
 #ifdef KNOWN_EXPBIT0_LOCATION
-# if defined USE_LONG_DOUBLE && ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_))
+# if defined USE_LONG_DOUBLE && ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) && !HAVE_SAME_LONG_DOUBLE_AS_DOUBLE
   /* Special CPU dependent code is needed to treat bit patterns outside the
      IEEE 754 specification (such as Pseudo-NaNs, Pseudo-Infinities,
      Pseudo-Zeroes, Unnormalized Numbers, and Pseudo-Denormals) as NaNs.
@@ -157,7 +157,7 @@ FUNC (DOUBLE x)
      the signaling NaNs, handle only the quiet NaNs.  */
   if (x == x)
     {
-# if defined USE_LONG_DOUBLE && ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_))
+# if defined USE_LONG_DOUBLE && ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) && !HAVE_SAME_LONG_DOUBLE_AS_DOUBLE
       /* Detect any special bit patterns that pass ==; see comment above.  */
       memory_double m1;
       memory_double m2;
index c79308b..daabe2a 100644 (file)
@@ -1,4 +1,4 @@
-# isnanl.m4 serial 16
+# isnanl.m4 serial 17
 dnl Copyright (C) 2007-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -56,6 +56,7 @@ dnl Prerequisites of replacement isnanl definition. It does not need -lm.
 AC_DEFUN([gl_PREREQ_ISNANL],
 [
   gl_LONG_DOUBLE_EXPONENT_LOCATION
+  AC_REQUIRE([gl_LONG_DOUBLE_VS_DOUBLE])
 ])
 
 dnl Test whether isnanl() can be used without libm.
@@ -116,6 +117,7 @@ AC_DEFUN([gl_FUNC_ISNANL_WORKS],
 [
   AC_REQUIRE([AC_PROG_CC])
   AC_REQUIRE([gl_BIGENDIAN])
+  AC_REQUIRE([gl_LONG_DOUBLE_VS_DOUBLE])
   AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
   AC_CACHE_CHECK([whether isnanl works], [gl_cv_func_isnanl_works],
     [
@@ -169,7 +171,7 @@ int main ()
       result |= 1;
   }
 
-#if ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_))
+#if ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) && !HAVE_SAME_LONG_DOUBLE_AS_DOUBLE
 /* Representation of an 80-bit 'long double' as an initializer for a sequence
    of 'unsigned int' words.  */
 # ifdef WORDS_BIGENDIAN
index 5a98e49..b3884fc 100644 (file)
@@ -8,6 +8,7 @@ lib/isnan.c
 lib/float+.h
 m4/exponentl.m4
 m4/isnanl.m4
+m4/math_h.m4
 
 Depends-on:
 float