]> Savannah Git Hosting - gnulib.git/commitdiff
ilogbl: Work around Cygwin bug.
authorBruno Haible <bruno@clisp.org>
Thu, 12 Dec 2019 11:38:40 +0000 (12:38 +0100)
committerBruno Haible <bruno@clisp.org>
Thu, 12 Dec 2019 11:38:40 +0000 (12:38 +0100)
* m4/ilogbl.m4 (gl_FUNC_ILOGBL_WORKS): Test whether ilogbl(0.0L) is
correct.
* doc/posix-functions/ilogbl.texi: Mention the Cygwin bug.

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

index 3cd4b9f9c0992702807301f565285b4d4aa87a5b..d62eb6145fbd778b35e9dcd2959069773d5ce478 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2019-12-12  Bruno Haible  <bruno@clisp.org>
+
+       ilogbl: Work around Cygwin bug.
+       * m4/ilogbl.m4 (gl_FUNC_ILOGBL_WORKS): Test whether ilogbl(0.0L) is
+       correct.
+       * doc/posix-functions/ilogbl.texi: Mention the Cygwin bug.
+
 2019-12-12  Bruno Haible  <bruno@clisp.org>
 
        strtold: Work around Cygwin bug.
index 416189009f459058fb65692e0eb078859211e0c5..ed87110cd586645592914f1bf03a7f0ee0b2bd77 100644 (file)
@@ -12,6 +12,10 @@ Portability problems fixed by Gnulib:
 This function is missing on some platforms:
 FreeBSD 5.2.1, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin, MSVC 9.
 @item
+This function returns a wrong result for a zero argument on some platforms:
+@c https://cygwin.com/ml/cygwin/2019-12/msg00074.html
+Cygwin 2.9.
+@item
 This function returns a wrong result for denormalized arguments on some platforms:
 Haiku 2017.
 @end itemize
index c8ba52a23e68980b97a0d575475864838b2f537c..ab274331ca02def80976e3dfe6c299f53463eb35 100644 (file)
@@ -1,4 +1,4 @@
-# ilogbl.m4 serial 3
+# ilogbl.m4 serial 4
 dnl Copyright (C) 2010-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -71,6 +71,7 @@ AC_DEFUN([gl_FUNC_ILOGBL],
 ])
 
 dnl Test whether ilogbl() works.
+dnl On Cygwin 2.9, ilogb(0.0L) is wrong.
 dnl On Haiku 2017, it returns i-2 instead of i-1 for values between
 dnl ca. 2^-16444 and ca. 2^-16382.
 AC_DEFUN([gl_FUNC_ILOGBL_WORKS],
@@ -108,13 +109,19 @@ int main (int argc, char *argv[])
 {
   int (* volatile my_ilogbl) (long double) = argc ? ilogbl : dummy;
   int result = 0;
+  /* This test fails on Cygwin 2.9.  */
+  {
+    x = 0.0L;
+    if (my_ilogbl (x) != FP_ILOGB0)
+      result |= 1;
+  }
   /* This test fails on Haiku 2017.  */
   {
     int i;
     for (i = 1, x = (long double)1.0; i >= LDBL_MIN_EXP-100 && x > (long double)0.0; i--, x *= (long double)0.5)
       if (my_ilogbl (x) != i - 1)
         {
-          result |= 1;
+          result |= 2;
           break;
         }
   }