]> Savannah Git Hosting - gnulib.git/commitdiff
logbl: Work around a glibc bug on PowerPC64LE.
authorBruno Haible <bruno@clisp.org>
Sat, 1 Jul 2017 15:10:31 +0000 (17:10 +0200)
committerBruno Haible <bruno@clisp.org>
Sat, 1 Jul 2017 15:10:31 +0000 (17:10 +0200)
* m4/logbl.m4 (gl_FUNC_LOGBL_WORKS): Test also negative subnormal
numbers.
* doc/posix-functions/logbl.texi: Update.

ChangeLog
doc/posix-functions/logbl.texi
m4/logbl.m4

index 7cce6df7973649908b31f6afcd2c4ea8f3cd9476..c10c2c328da70fed14ce5440e1daebca581e87bd 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2017-07-01  Bruno Haible  <bruno@clisp.org>
+
+       logbl: Work around a glibc bug on PowerPC64LE.
+       * m4/logbl.m4 (gl_FUNC_LOGBL_WORKS): Test also negative subnormal
+       numbers.
+       * doc/posix-functions/logbl.texi: Update.
+
 2017-06-29  Bruno Haible  <bruno@clisp.org>
 
        stat, fstat: Compile stat-w32.c only on platforms that need it.
index fd9c384d981788a80aa2a5080e4ff445becdf27c..857c776bd6360f6d5e3b5289e10c3380aa215c1b 100644 (file)
@@ -13,7 +13,8 @@ This function is missing on some platforms:
 FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, older IRIX 6.5, Solaris 9, Cygwin, MSVC 9, Interix 3.5, BeOS.
 @item
 This function produces wrong results for subnormal numbers on some platforms:
-glibc 2.11/ppc, glibc 2.7/sparc, glibc 2.7/hppa, Solaris 11 2011-11.
+glibc 2.11/powerpc, glibc 2.7/sparc, glibc 2.7/hppa, Solaris 11 2011-11,
+glibc 2.23/powerpc64le.
 @end itemize
 
 Portability problems not fixed by Gnulib:
index db0a36d5edcbd21ab46ccd6d7671884a170079d3..5e236f5de677deb9053b1b3d520216fccd0ad72a 100644 (file)
@@ -1,4 +1,4 @@
-# logbl.m4 serial 2
+# logbl.m4 serial 3
 dnl Copyright (C) 2012-2017 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -54,8 +54,10 @@ AC_DEFUN([gl_FUNC_LOGBL],
 ])
 
 dnl Test whether logbl() works.
-dnl On glibc 2.11/ppc, glibc 2.7/sparc, glibc 2.7/hppa, Solaris 10/SPARC, the
-dnl return value for subnormal (denormalized) arguments is too large.
+dnl On glibc 2.11/powerpc, glibc 2.7/sparc, glibc 2.7/hppa, Solaris 10/SPARC,
+dnl the return value for subnormal (denormalized) arguments is too large.
+dnl On glibc 2.23/powerpc64le, the return value for negative subnormal arguments
+dnl is too large.
 AC_DEFUN([gl_FUNC_LOGBL_WORKS],
 [
   AC_REQUIRE([AC_PROG_CC])
@@ -94,6 +96,11 @@ int main ()
     if ((i == LDBL_MIN_EXP - 1 || i == LDBL_MIN_EXP - 54)
         && (x > 0.0L && !(logbl (x) == (long double)(i - 1))))
       return 1;
+  for (i = 1, x = -1.0L; i >= LDBL_MIN_EXP - 54; i--, x *= 0.5L)
+    /* Either x = -2^(i-1) or x = 0.0.  */
+    if ((i == LDBL_MIN_EXP - 1 || i == LDBL_MIN_EXP - 54)
+        && (x < 0.0L && !(logbl (x) == (long double)(i - 1))))
+      return 1;
   return 0;
 }
 ]])],