]> Savannah Git Hosting - gnulib.git/commitdiff
log10l: Work around bug on NetBSD 9.3/arm64.
authorBruno Haible <bruno@clisp.org>
Thu, 18 Jan 2024 18:46:53 +0000 (19:46 +0100)
committerBruno Haible <bruno@clisp.org>
Wed, 31 Jan 2024 16:43:46 +0000 (17:43 +0100)
* m4/log10l.m4 (gl_FUNC_LOG10L_WORKS): Add another test case, taken from
the unit test.

ChangeLog
m4/log10l.m4

index ccd67c1bb7e867bac32b83fbb978e38d30dda541..c996c1e7842a31f8f70156f9f6bff222abede392 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2024-01-18  Bruno Haible  <bruno@clisp.org>
+
+       log10l: Work around bug on NetBSD 9.3/arm64.
+       * m4/log10l.m4 (gl_FUNC_LOG10L_WORKS): Add another test case, taken from
+       the unit test.
+
 2024-01-18  Bruno Haible  <bruno@clisp.org>
 
        modfl: Work around bug on NetBSD 9.3/arm64.
index b3efe27530bf104fc35c729714731b843a7cc834..3a4e21f5f99abc09add5ef1acc4b07a8a9aa3c37 100644 (file)
@@ -1,4 +1,4 @@
-# log10l.m4 serial 12
+# log10l.m4 serial 12.1
 dnl Copyright (C) 2011-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,
@@ -115,6 +115,12 @@ long double gy;
 int main (int argc, char *argv[])
 {
   long double (* volatile my_log10l) (long double) = argc ? log10l : dummy;
+  const long double TWO_LDBL_MANT_DIG = /* 2^LDBL_MANT_DIG */
+    (long double) (1U << ((LDBL_MANT_DIG - 1) / 5))
+    * (long double) (1U << ((LDBL_MANT_DIG - 1 + 1) / 5))
+    * (long double) (1U << ((LDBL_MANT_DIG - 1 + 2) / 5))
+    * (long double) (1U << ((LDBL_MANT_DIG - 1 + 3) / 5))
+    * (long double) (1U << ((LDBL_MANT_DIG - 1 + 4) / 5));
   int result = 0;
   /* Dummy call, to trigger the AIX 5.1 bug.  */
   gx = 0.6L;
@@ -126,19 +132,21 @@ int main (int argc, char *argv[])
     if (!(gy + gy == gy))
       result |= 1;
   }
-  /* This test fails on musl 1.2.2/arm64, musl 1.2.2/s390x, NetBSD 9.0.  */
+  /* This test fails on musl 1.2.2/arm64, musl 1.2.2/s390x,
+     NetBSD 9.3 except arm64.  */
   {
-    const long double TWO_LDBL_MANT_DIG = /* 2^LDBL_MANT_DIG */
-      (long double) (1U << ((LDBL_MANT_DIG - 1) / 5))
-      * (long double) (1U << ((LDBL_MANT_DIG - 1 + 1) / 5))
-      * (long double) (1U << ((LDBL_MANT_DIG - 1 + 2) / 5))
-      * (long double) (1U << ((LDBL_MANT_DIG - 1 + 3) / 5))
-      * (long double) (1U << ((LDBL_MANT_DIG - 1 + 4) / 5));
     long double x = 7.90097792256024576L;
     long double err = (my_log10l (x) + my_log10l (1.0L / x)) * TWO_LDBL_MANT_DIG;
     if (!(err >= -100.0L && err <= 100.0L))
       result |= 2;
   }
+  /* This test fails on NetBSD 9.3/arm64.  */
+  {
+    long double x = 13.53398352203022253L;
+    long double err = (my_log10l (x) + my_log10l (1.0L / x)) * TWO_LDBL_MANT_DIG;
+    if (!(err >= -100.0L && err <= 100.0L))
+      result |= 4;
+  }
   return result;
 }
 ]])],