summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2021-01-06 11:06:25 +0100
committerBruno Haible <bruno@clisp.org>2021-01-06 11:11:52 +0100
commit1ac1751add634045d353c5ff1eb8f435737bc1ea (patch)
treec1648523c1fd5873e04c5fec16125985e2d4fafd
parent1ca1485fcab80578c159a38b9fd6776a337a68cf (diff)
downloadgnulib-1ac1751add634045d353c5ff1eb8f435737bc1ea.tar.gz
ilogb: Fix test failures on AIX 7.1 in 64-bit mode.
* m4/ilogb.m4 (gl_FUNC_ILOGB_WORKS): Test also some denormalized argument. * doc/posix-functions/ilogb.texi: Mention the AIX bug.
-rw-r--r--ChangeLog7
-rw-r--r--doc/posix-functions/ilogb.texi3
-rw-r--r--m4/ilogb.m417
3 files changed, 24 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index a86fe7e5aa..2adaf5a696 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2021-01-06 Bruno Haible <bruno@clisp.org>
+
+ ilogb: Fix test failures on AIX 7.1 in 64-bit mode.
+ * m4/ilogb.m4 (gl_FUNC_ILOGB_WORKS): Test also some denormalized
+ argument.
+ * doc/posix-functions/ilogb.texi: Mention the AIX bug.
+
2021-01-05 Bruno Haible <bruno@clisp.org>
fclose: Fix test failure on AIX 7.2.
diff --git a/doc/posix-functions/ilogb.texi b/doc/posix-functions/ilogb.texi
index 1b266766fc..edcba7c6c8 100644
--- a/doc/posix-functions/ilogb.texi
+++ b/doc/posix-functions/ilogb.texi
@@ -15,6 +15,9 @@ Minix 3.1.8, MSVC 9.
This function returns a wrong result for a zero argument on some platforms:
OpenBSD 6.7, AIX 5.1.
@item
+This function returns a wrong result for denormalized arguments on some platforms:
+AIX 7.1 64-bit.
+@item
This function returns a wrong result for an infinite argument on some platforms:
NetBSD 7.1, OpenBSD 6.7.
@item
diff --git a/m4/ilogb.m4 b/m4/ilogb.m4
index 29e472ccd1..54043906d0 100644
--- a/m4/ilogb.m4
+++ b/m4/ilogb.m4
@@ -1,4 +1,4 @@
-# ilogb.m4 serial 6
+# ilogb.m4 serial 7
dnl Copyright (C) 2010-2021 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -44,6 +44,7 @@ AC_DEFUN([gl_FUNC_ILOGB],
dnl Test whether ilogb() works.
dnl On OpenBSD 6.7, AIX 5.1, ilogb(0.0) is wrong.
+dnl On AIX 7.1 in 64-bit mode, ilogb(2^(DBL_MIN_EXP-1)) is wrong.
dnl On NetBSD 7.1, OpenBSD 6.7, ilogb(Infinity) is wrong.
dnl On NetBSD 7.1, OpenBSD 6.7, ilogb(NaN) is wrong.
AC_DEFUN([gl_FUNC_ILOGB_WORKS],
@@ -54,6 +55,7 @@ AC_DEFUN([gl_FUNC_ILOGB_WORKS],
[
AC_RUN_IFELSE(
[AC_LANG_SOURCE([[
+#include <float.h>
#include <limits.h>
#include <math.h>
/* Provide FP_ILOGB0, FP_ILOGBNAN, like in math.in.h. */
@@ -93,17 +95,26 @@ int main (int argc, char *argv[])
if (my_ilogb (x) != FP_ILOGB0)
result |= 1;
}
+ /* This test fails on AIX 7.1 in 64-bit mode. */
+ {
+ int i;
+ x = 0.5;
+ for (i = DBL_MIN_EXP - 1; i < 0; i++)
+ x = x * 0.5;
+ if (x > 0.0 && my_ilogb (x) != DBL_MIN_EXP - 2)
+ result |= 2;
+ }
/* This test fails on NetBSD 7.1, OpenBSD 6.7. */
{
x = 1.0 / zero;
if (my_ilogb (x) != INT_MAX)
- result |= 2;
+ result |= 4;
}
/* This test fails on NetBSD 7.1, OpenBSD 6.7. */
{
x = zero / zero;
if (my_ilogb (x) != FP_ILOGBNAN)
- result |= 4;
+ result |= 8;
}
return result;
}