]> Savannah Git Hosting - gnulib.git/commitdiff
expm1l: Work around a NetBSD 10.0/i386 bug.
authorBruno Haible <bruno@clisp.org>
Sat, 6 Apr 2024 10:01:59 +0000 (12:01 +0200)
committerBruno Haible <bruno@clisp.org>
Sat, 6 Apr 2024 10:06:33 +0000 (12:06 +0200)
* m4/expm1l.m4 (gl_FUNC_EXPM1L): Test the value of
expm1l(2^LDBL_MIN_EXP).
* doc/posix-functions/expm1l.texi: Mention the NetBSD 10.0/i386 bug.
* tests/test-expm1.h (test_function): Allow more deviation on
NetBSD/i386.

ChangeLog
doc/posix-functions/expm1l.texi
m4/expm1l.m4
tests/test-expm1.h

index ea2ed1b7ecb50c6803fd499c4ddb70a7dd8aab2b..9d069b83e226cc8580a67f69f89682c6f9be413d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2024-04-06  Bruno Haible  <bruno@clisp.org>
+
+       expm1l: Work around a NetBSD 10.0/i386 bug.
+       * m4/expm1l.m4 (gl_FUNC_EXPM1L): Test the value of
+       expm1l(2^LDBL_MIN_EXP).
+       * doc/posix-functions/expm1l.texi: Mention the NetBSD 10.0/i386 bug.
+       * tests/test-expm1.h (test_function): Allow more deviation on
+       NetBSD/i386.
+
 2024-04-05  Bruno Haible  <bruno@clisp.org>
 
        exp2l: Work around a NetBSD 10.0/i386 bug.
index f8c68c9d45534d48bbf7e46f09c03e67f421ab2d..f8a015b3da28b4443c6057beb05d513a005312a8 100644 (file)
@@ -15,9 +15,12 @@ FreeBSD 6.0, NetBSD 9.3, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, older IRIX
 This function is not declared on some platforms:
 IRIX 6.5.
 @item
+This function returns 0 instead of small positive values on some platforms:
+NetBSD 10.0/i386.
+@item
 This function produces results which are accurate to only 16 digits on some
 platforms:
-musl libc 1.2.2/arm64, musl libc 1.2.2/s390x, Mac OS X 10.5, NetBSD 10.0.
+musl libc 1.2.2/arm64, musl libc 1.2.2/s390x, Mac OS X 10.5, NetBSD 10.0/x86_64.
 @end itemize
 
 Portability problems not fixed by Gnulib:
index cdd51ae20141387e377749e679c40cefe9ff0533..3e75891ac38c0d2072615d004313f096f0e9502c 100644 (file)
@@ -1,5 +1,5 @@
 # expm1l.m4
-# serial 13
+# serial 14
 dnl Copyright (C) 2010-2024 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -125,7 +125,7 @@ int main (int argc, char *argv[])
   long double (* volatile my_expm1l) (long double) = argc ? expm1l : dummy;
   int result = 0;
   /* This test fails on musl 1.2.2/arm64, musl 1.2.2/s390x, Mac OS X 10.5,
-     NetBSD 10.0.  */
+     NetBSD 10.0/x86_64.  */
   {
     const long double TWO_LDBL_MANT_DIG = /* 2^LDBL_MANT_DIG */
       (long double) (1U << ((LDBL_MANT_DIG - 1) / 5))
@@ -141,6 +141,18 @@ int main (int argc, char *argv[])
     if (!(err >= -100.0L && err <= 100.0L))
       result |= 1;
   }
+  /* This test fails on NetBSD 10.0/i386.  */
+  {
+    int i;
+    long double x;
+    volatile long double y;
+    for (i = -1, x = 0.5L; i > LDBL_MIN_EXP; i--, x *= 0.5L)
+      ;
+    /* Here i = LDBL_MIN_EXP, x = 2^LDBL_MIN_EXP.  */
+    y = my_expm1l (x);
+    if (!(y >= x))
+      result |= 2;
+  }
   return result;
 }
             ]])],
index 01128c491d1025f588c5e704fe5421404bf47c62..fc92617a05e07f9a9e3f3b8588f49598687c6d0e 100644 (file)
@@ -52,7 +52,9 @@ test_function (void)
     /* Error bound, in ulps.  */
     const DOUBLE err_bound =
       (sizeof (DOUBLE) > sizeof (double) ?
-#if defined __i386__ && defined __FreeBSD__
+#if defined __i386__ && defined __NetBSD__
+       L_(1025.0)
+#elif defined __i386__ && defined __FreeBSD__
        /* On FreeBSD/x86 6.4, the 'long double' type really has only 53 bits of
           precision in the compiler but 64 bits of precision at runtime.  See
           <https://lists.gnu.org/r/bug-gnulib/2008-07/msg00063.html>.
@@ -83,6 +85,8 @@ test_function (void)
       (sizeof (DOUBLE) > sizeof (double) ?
 #if defined __i386__ && defined __FreeBSD__
        L_(1536.0)
+#elif defined __i386__ && defined __NetBSD__
+       L_(1026.0)
 #else
        L_(11.0)
 #endif