bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
From: Bruno Haible <bruno@clisp.org>
To: bug-gnulib@gnu.org
Subject: log10l: Work around bug on NetBSD 9.3/arm64
Date: Thu, 18 Jan 2024 19:51:44 +0100	[thread overview]
Message-ID: <3809511.07ICAnoMbH@nimes> (raw)

On NetBSD 9.3/arm64 I see a test failure:

$ ./test-log10l
../../gltests/test-log10.h:68: assertion 'err > - err_bound / TWO_MANT_DIG && err < err_bound / TWO_MANT_DIG' failed

The reason is that the configure test "whether log10l works..." has not
detected the broken NetBSD log10l() function. This patch fixes it.


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.

diff --git a/m4/log10l.m4 b/m4/log10l.m4
index aefa2df029..ee352b11f6 100644
--- a/m4/log10l.m4
+++ b/m4/log10l.m4
@@ -1,4 +1,4 @@
-# log10l.m4 serial 14
+# log10l.m4 serial 15
 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 @@ AC_DEFUN([gl_FUNC_LOG10L_WORKS]
 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 @@ AC_DEFUN([gl_FUNC_LOG10L_WORKS]
     if (!(gy + gy == gy))
       result |= 1;
   }
-  /* This test fails on musl 1.2.2/arm64, musl 1.2.2/s390x, NetBSD 9.3.  */
+  /* 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;
 }
 ]])],





                 reply	other threads:[~2024-01-18 18:52 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3809511.07ICAnoMbH@nimes \
    --to=bruno@clisp.org \
    --cc=bug-gnulib@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).