glibc 2.40 adds the function families
  exp10m1
  exp2m1
  log10p1
  log2p1
  logp1
All are specified by ISO C23.

This set of patches adds the logp1 family to gnulib.


2024-07-29  Bruno Haible  <br...@clisp.org>

        logp1l: Add tests.
        * tests/test-logp1l.c: New file, based on tests/test-log1pl.c.
        * modules/logp1l-tests: New file.

        logp1l: New module.
        * lib/math.in.h (logp1l): New declaration.
        * lib/logp1l.c: New file.
        * m4/logp1l.m4: New file.
        * m4/math_h.m4 (gl_MATH_H): Test whether logp1l is declared.
        (gl_MATH_H_REQUIRE_DEFAULTS): Initialize GNULIB_LOGP1L.
        (gl_MATH_H_DEFAULTS): Initialize HAVE_LOGP1L.
        * modules/math (Makefile.am): Substitute GNULIB_LOGP1L, HAVE_LOGP1L.
        * modules/logp1l: New file.
        * doc/posix-functions/logp1l.texi: Mention the new module.

2024-07-29  Bruno Haible  <br...@clisp.org>

        logp1f: Add tests.
        * tests/test-logp1f.c: New file, based on tests/test-log1pf.c.
        * modules/logp1f-tests: New file.

        logp1f: New module.
        * lib/math.in.h (logp1f): New declaration.
        * lib/logp1f.c: New file.
        * m4/logp1f.m4: New file.
        * m4/log1p.m4 (gl_FUNC_LOG1P): Define through AC_DEFUN_ONCE.
        * m4/isnand.m4 (gl_FUNC_ISNAND): Define through AC_DEFUN_ONCE.
        * m4/math_h.m4 (gl_MATH_H): Test whether logp1f is declared.
        (gl_MATH_H_DEFAULTS): Initialize HAVE_LOGP1F.
        * modules/math (Makefile.am): Substitute GNULIB_LOGP1F, HAVE_LOGP1F.
        * modules/logp1f: New file.
        * doc/posix-functions/logp1f.texi: Mention the new module.

2024-07-29  Bruno Haible  <br...@clisp.org>

        logp1: Add tests.
        * tests/test-logp1.c: New file, based on tests/test-log1p.c.
        * modules/logp1-tests: New file.

        logp1: New module.
        * lib/math.in.h (logp1): New declaration.
        * lib/logp1.c: New file.
        * m4/logp1.m4: New file.
        * m4/math_h.m4 (gl_MATH_H): Test whether logp1 is declared.
        (gl_MATH_H_REQUIRE_DEFAULTS): Initialize GNULIB_LOGP1.
        (gl_MATH_H_DEFAULTS): Initialize HAVE_LOGP1.
        * modules/math (Makefile.am): Substitute GNULIB_LOGP1, HAVE_LOGP1.
        * modules/logp1: New file.
        * doc/posix-functions/logp1.texi: Mention the new module.

>From 4cab49fa7925658314d3b87ce999cabeb8f063b7 Mon Sep 17 00:00:00 2001
From: Bruno Haible <br...@clisp.org>
Date: Mon, 29 Jul 2024 03:24:51 +0200
Subject: [PATCH 1/6] logp1: New module.

* lib/math.in.h (logp1): New declaration.
* lib/logp1.c: New file.
* m4/logp1.m4: New file.
* m4/math_h.m4 (gl_MATH_H): Test whether logp1 is declared.
(gl_MATH_H_REQUIRE_DEFAULTS): Initialize GNULIB_LOGP1.
(gl_MATH_H_DEFAULTS): Initialize HAVE_LOGP1.
* modules/math (Makefile.am): Substitute GNULIB_LOGP1, HAVE_LOGP1.
* modules/logp1: New file.
* doc/posix-functions/logp1.texi: Mention the new module.
---
 ChangeLog                      | 13 +++++++++++++
 doc/posix-functions/logp1.texi |  8 ++++----
 lib/logp1.c                    | 26 ++++++++++++++++++++++++++
 lib/math.in.h                  | 17 +++++++++++++++++
 m4/logp1.m4                    | 30 ++++++++++++++++++++++++++++++
 m4/math_h.m4                   |  6 ++++--
 modules/logp1                  | 33 +++++++++++++++++++++++++++++++++
 modules/math                   |  2 ++
 8 files changed, 129 insertions(+), 6 deletions(-)
 create mode 100644 lib/logp1.c
 create mode 100644 m4/logp1.m4
 create mode 100644 modules/logp1

diff --git a/ChangeLog b/ChangeLog
index a809663d01..20132c3abf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2024-07-29  Bruno Haible  <br...@clisp.org>
+
+	logp1: New module.
+	* lib/math.in.h (logp1): New declaration.
+	* lib/logp1.c: New file.
+	* m4/logp1.m4: New file.
+	* m4/math_h.m4 (gl_MATH_H): Test whether logp1 is declared.
+	(gl_MATH_H_REQUIRE_DEFAULTS): Initialize GNULIB_LOGP1.
+	(gl_MATH_H_DEFAULTS): Initialize HAVE_LOGP1.
+	* modules/math (Makefile.am): Substitute GNULIB_LOGP1, HAVE_LOGP1.
+	* modules/logp1: New file.
+	* doc/posix-functions/logp1.texi: Mention the new module.
+
 2024-07-28  Bruno Haible  <br...@clisp.org>
 
 	More updates regarding the 'Useable-in-testdir' sections.
diff --git a/doc/posix-functions/logp1.texi b/doc/posix-functions/logp1.texi
index 022b297d4c..4f1c15cb6c 100644
--- a/doc/posix-functions/logp1.texi
+++ b/doc/posix-functions/logp1.texi
@@ -4,15 +4,15 @@
 
 ISO C23 specification:@* @url{http://www.open-std.org/jtc1/sc22/wg14/www/docs/n3220.pdf} section 7.12.6.14
 
-Gnulib module: ---
+Gnulib module: logp1
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on all non-glibc platforms:
+glibc 2.39, macOS 14, FreeBSD 14.0, NetBSD 10.0, OpenBSD 7.5, Minix 3.3.0, AIX 7.3.1, HP-UX 11.31, Solaris 11.4, Cygwin 3.5.3, mingw, MSVC 14, Android.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
-@item
-This function is missing on all non-glibc platforms:
-glibc 2.39, macOS 14, FreeBSD 14.0, NetBSD 10.0, OpenBSD 7.5, Minix 3.3.0, AIX 7.3.1, HP-UX 11.31, Solaris 11.4, Cygwin 3.5.3, mingw, MSVC 14, Android.
 @end itemize
diff --git a/lib/logp1.c b/lib/logp1.c
new file mode 100644
index 0000000000..ed3633ad58
--- /dev/null
+++ b/lib/logp1.c
@@ -0,0 +1,26 @@
+/* Natural logarithm of argument plus 1.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation, either version 3 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <math.h>
+
+double
+logp1 (double x)
+{
+  return log1p (x);
+}
diff --git a/lib/math.in.h b/lib/math.in.h
index a1ae4e7328..8effcbd6be 100644
--- a/lib/math.in.h
+++ b/lib/math.in.h
@@ -1859,6 +1859,23 @@ _GL_WARN_ON_USE (logbl, "logbl is unportable - "
 #endif
 
 
+#if @GNULIB_LOGP1@
+# if !@HAVE_LOGP1@
+_GL_FUNCDECL_SYS (logp1, double, (double x));
+# endif
+_GL_CXXALIAS_SYS (logp1, double, (double x));
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN1 (logp1, double, (double x));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef logp1
+# if HAVE_RAW_DECL_LOGP1
+_GL_WARN_ON_USE (logp1, "logp1 is unportable - "
+                 "use gnulib module logp1 for portability");
+# endif
+#endif
+
+
 #if @GNULIB_MODFF@
 # if @REPLACE_MODFF@
 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
diff --git a/m4/logp1.m4 b/m4/logp1.m4
new file mode 100644
index 0000000000..485daaac76
--- /dev/null
+++ b/m4/logp1.m4
@@ -0,0 +1,30 @@
+# logp1.m4
+# serial 1
+dnl Copyright (C) 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,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_FUNC_LOGP1],
+[
+  AC_REQUIRE([gl_MATH_H_DEFAULTS])
+
+  dnl Persuade glibc <math.h> to declare logp1().
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+
+  dnl Determine LOGP1_LIBM.
+  gl_COMMON_DOUBLE_MATHFUNC([logp1])
+
+  dnl Test whether logp1() exists.
+  saved_LIBS="$LIBS"
+  LIBS="$LIBS $LOGP1_LIBM"
+  AC_CHECK_FUNCS([logp1])
+  LIBS="$saved_LIBS"
+  if test $ac_cv_func_logp1 = no; then
+    HAVE_LOGP1=0
+    dnl We implement logp1 through log1p.
+    AC_REQUIRE([gl_FUNC_LOG1P])
+    LOGP1_LIBM="$LOG1P_LIBM"
+  fi
+  AC_SUBST([LOGP1_LIBM])
+])
diff --git a/m4/math_h.m4 b/m4/math_h.m4
index 4b26c9e9dc..8781c082df 100644
--- a/m4/math_h.m4
+++ b/m4/math_h.m4
@@ -1,5 +1,5 @@
 # math_h.m4
-# serial 138
+# serial 139
 dnl Copyright (C) 2007-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,
@@ -49,7 +49,7 @@ AC_DEFUN_ONCE([gl_MATH_H]
      ilogb ilogbf ilogbl
      ldexpf ldexpl
      log logf logl log10 log10f log10l log1p log1pf log1pl log2 log2f log2l
-     logb logbf logbl
+     logb logbf logbl logp1
      modf modff modfl powf
      remainder remainderf remainderl
      rint rintf rintl round roundf roundl
@@ -153,6 +153,7 @@ AC_DEFUN([gl_MATH_H_REQUIRE_DEFAULTS]
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGB])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGBF])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGBL])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGP1])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MODF])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MODFF])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MODFL])
@@ -253,6 +254,7 @@ AC_DEFUN([gl_MATH_H_DEFAULTS]
   HAVE_LOG1PL=1;                    AC_SUBST([HAVE_LOG1PL])
   HAVE_LOGBF=1;                     AC_SUBST([HAVE_LOGBF])
   HAVE_LOGBL=1;                     AC_SUBST([HAVE_LOGBL])
+  HAVE_LOGP1=1;                     AC_SUBST([HAVE_LOGP1])
   HAVE_MODFF=1;                     AC_SUBST([HAVE_MODFF])
   HAVE_MODFL=1;                     AC_SUBST([HAVE_MODFL])
   HAVE_POWF=1;                      AC_SUBST([HAVE_POWF])
diff --git a/modules/logp1 b/modules/logp1
new file mode 100644
index 0000000000..1d6b80bdc9
--- /dev/null
+++ b/modules/logp1
@@ -0,0 +1,33 @@
+Description:
+logp1() function: natural logarithm of argument plus 1.
+
+Files:
+lib/logp1.c
+m4/logp1.m4
+m4/mathfunc.m4
+
+Depends-on:
+math
+log1p           [test $HAVE_LOGP1 = 0]
+
+configure.ac:
+gl_FUNC_LOGP1
+gl_CONDITIONAL([GL_COND_OBJ_LOGP1], [test $HAVE_LOGP1 = 0])
+gl_MATH_MODULE_INDICATOR([logp1])
+
+Makefile.am:
+if GL_COND_OBJ_LOGP1
+lib_SOURCES += logp1.c
+endif
+
+Include:
+<math.h>
+
+Link:
+$(LOGP1_LIBM)
+
+License:
+LGPL
+
+Maintainer:
+all
diff --git a/modules/math b/modules/math
index 983c7bf91e..fed10a5c5e 100644
--- a/modules/math
+++ b/modules/math
@@ -110,6 +110,7 @@ math.h: math.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(
 	      -e 's/@''GNULIB_LOGB''@/$(GNULIB_LOGB)/g' \
 	      -e 's/@''GNULIB_LOGBF''@/$(GNULIB_LOGBF)/g' \
 	      -e 's/@''GNULIB_LOGBL''@/$(GNULIB_LOGBL)/g' \
+	      -e 's/@''GNULIB_LOGP1''@/$(GNULIB_LOGP1)/g' \
 	      -e 's/@''GNULIB_MODF''@/$(GNULIB_MODF)/g' \
 	      -e 's/@''GNULIB_MODFF''@/$(GNULIB_MODFF)/g' \
 	      -e 's/@''GNULIB_MODFL''@/$(GNULIB_MODFL)/g' \
@@ -203,6 +204,7 @@ math.h: math.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(
 	      -e 's|@''HAVE_LOG1PL''@|$(HAVE_LOG1PL)|g' \
 	      -e 's|@''HAVE_LOGBF''@|$(HAVE_LOGBF)|g' \
 	      -e 's|@''HAVE_LOGBL''@|$(HAVE_LOGBL)|g' \
+	      -e 's|@''HAVE_LOGP1''@|$(HAVE_LOGP1)|g' \
 	      -e 's|@''HAVE_MODFF''@|$(HAVE_MODFF)|g' \
 	      -e 's|@''HAVE_MODFL''@|$(HAVE_MODFL)|g' \
 	      -e 's|@''HAVE_POWF''@|$(HAVE_POWF)|g' \
-- 
2.34.1

>From 76531f80e62fcf97662b3ab570cecad64c0aed5e Mon Sep 17 00:00:00 2001
From: Bruno Haible <br...@clisp.org>
Date: Mon, 29 Jul 2024 03:56:28 +0200
Subject: [PATCH 2/6] logp1: Add tests.

* tests/test-logp1.c: New file, based on tests/test-log1p.c.
* modules/logp1-tests: New file.
---
 ChangeLog           |  4 ++++
 modules/logp1-tests | 16 +++++++++++++++
 tests/test-logp1.c  | 49 +++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 69 insertions(+)
 create mode 100644 modules/logp1-tests
 create mode 100644 tests/test-logp1.c

diff --git a/ChangeLog b/ChangeLog
index 20132c3abf..4b06ddac4c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2024-07-29  Bruno Haible  <br...@clisp.org>
 
+	logp1: Add tests.
+	* tests/test-logp1.c: New file, based on tests/test-log1p.c.
+	* modules/logp1-tests: New file.
+
 	logp1: New module.
 	* lib/math.in.h (logp1): New declaration.
 	* lib/logp1.c: New file.
diff --git a/modules/logp1-tests b/modules/logp1-tests
new file mode 100644
index 0000000000..80d5c1ba14
--- /dev/null
+++ b/modules/logp1-tests
@@ -0,0 +1,16 @@
+Files:
+tests/test-logp1.c
+tests/test-log1p.h
+tests/signature.h
+tests/macros.h
+tests/randomd.c
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-logp1
+check_PROGRAMS += test-logp1
+test_logp1_SOURCES = test-logp1.c randomd.c
+test_logp1_LDADD = $(LDADD) @LOGP1_LIBM@
diff --git a/tests/test-logp1.c b/tests/test-logp1.c
new file mode 100644
index 0000000000..fbcdf7dc5b
--- /dev/null
+++ b/tests/test-logp1.c
@@ -0,0 +1,49 @@
+/* Test of logp1() function.
+   Copyright (C) 2010-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <br...@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include <math.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (logp1, double, (double));
+
+#include <float.h>
+
+#include "macros.h"
+
+#define DOUBLE double
+#define HUGEVAL HUGE_VAL
+#define L_(literal) literal
+#define MANT_DIG DBL_MANT_DIG
+#define LOG1P logp1
+#define RANDOM randomd
+#include "test-log1p.h"
+
+int
+main ()
+{
+  /* A particular value.  */
+  x = 0.6;
+  y = logp1 (x);
+  ASSERT (y >= 0.4700036292 && y <= 0.4700036293);
+
+  test_function ();
+
+  return test_exit_status;
+}
-- 
2.34.1

>From 4fc589a2d2e7e1f543d7dba8bfefc44ee6a5d7ff Mon Sep 17 00:00:00 2001
From: Bruno Haible <br...@clisp.org>
Date: Mon, 29 Jul 2024 13:15:23 +0200
Subject: [PATCH 3/6] logp1f: New module.

* lib/math.in.h (logp1f): New declaration.
* lib/logp1f.c: New file.
* m4/logp1f.m4: New file.
* m4/log1p.m4 (gl_FUNC_LOG1P): Define through AC_DEFUN_ONCE.
* m4/isnand.m4 (gl_FUNC_ISNAND): Define through AC_DEFUN_ONCE.
* m4/math_h.m4 (gl_MATH_H): Test whether logp1f is declared.
(gl_MATH_H_REQUIRE_DEFAULTS): Initialize GNULIB_LOGP1F.
(gl_MATH_H_DEFAULTS): Initialize HAVE_LOGP1F.
* modules/math (Makefile.am): Substitute GNULIB_LOGP1F, HAVE_LOGP1F.
* modules/logp1f: New file.
* doc/posix-functions/logp1f.texi: Mention the new module.
---
 ChangeLog                       | 14 ++++++++++++
 doc/posix-functions/logp1f.texi |  8 +++----
 lib/logp1f.c                    | 26 ++++++++++++++++++++++
 lib/math.in.h                   | 16 ++++++++++++++
 m4/isnand.m4                    |  4 ++--
 m4/log1p.m4                     |  4 ++--
 m4/logp1f.m4                    | 31 ++++++++++++++++++++++++++
 m4/math_h.m4                    |  6 +++--
 modules/logp1f                  | 39 +++++++++++++++++++++++++++++++++
 modules/math                    |  2 ++
 10 files changed, 140 insertions(+), 10 deletions(-)
 create mode 100644 lib/logp1f.c
 create mode 100644 m4/logp1f.m4
 create mode 100644 modules/logp1f

diff --git a/ChangeLog b/ChangeLog
index 4b06ddac4c..c16b3d27c7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2024-07-29  Bruno Haible  <br...@clisp.org>
+
+	logp1f: New module.
+	* lib/math.in.h (logp1f): New declaration.
+	* lib/logp1f.c: New file.
+	* m4/logp1f.m4: New file.
+	* m4/log1p.m4 (gl_FUNC_LOG1P): Define through AC_DEFUN_ONCE.
+	* m4/isnand.m4 (gl_FUNC_ISNAND): Define through AC_DEFUN_ONCE.
+	* m4/math_h.m4 (gl_MATH_H): Test whether logp1f is declared.
+	(gl_MATH_H_DEFAULTS): Initialize HAVE_LOGP1F.
+	* modules/math (Makefile.am): Substitute GNULIB_LOGP1F, HAVE_LOGP1F.
+	* modules/logp1f: New file.
+	* doc/posix-functions/logp1f.texi: Mention the new module.
+
 2024-07-29  Bruno Haible  <br...@clisp.org>
 
 	logp1: Add tests.
diff --git a/doc/posix-functions/logp1f.texi b/doc/posix-functions/logp1f.texi
index ba8ab72025..0ca7970207 100644
--- a/doc/posix-functions/logp1f.texi
+++ b/doc/posix-functions/logp1f.texi
@@ -4,15 +4,15 @@
 
 ISO C23 specification:@* @url{http://www.open-std.org/jtc1/sc22/wg14/www/docs/n3220.pdf} section 7.12.6.14
 
-Gnulib module: ---
+Gnulib module: logp1f
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on all non-glibc platforms:
+glibc 2.39, macOS 14, FreeBSD 14.0, NetBSD 10.0, OpenBSD 7.5, Minix 3.3.0, AIX 7.3.1, HP-UX 11.31, Solaris 11.4, Cygwin 3.5.3, mingw, MSVC 14, Android.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
-@item
-This function is missing on all non-glibc platforms:
-glibc 2.39, macOS 14, FreeBSD 14.0, NetBSD 10.0, OpenBSD 7.5, Minix 3.3.0, AIX 7.3.1, HP-UX 11.31, Solaris 11.4, Cygwin 3.5.3, mingw, MSVC 14, Android.
 @end itemize
diff --git a/lib/logp1f.c b/lib/logp1f.c
new file mode 100644
index 0000000000..0bb1486245
--- /dev/null
+++ b/lib/logp1f.c
@@ -0,0 +1,26 @@
+/* Natural logarithm of argument plus 1.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation, either version 3 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <math.h>
+
+float
+logp1f (float x)
+{
+  return log1pf (x);
+}
diff --git a/lib/math.in.h b/lib/math.in.h
index 8effcbd6be..cb99d9798e 100644
--- a/lib/math.in.h
+++ b/lib/math.in.h
@@ -1859,6 +1859,22 @@ _GL_WARN_ON_USE (logbl, "logbl is unportable - "
 #endif
 
 
+#if @GNULIB_LOGP1F@
+# if !@HAVE_LOGP1F@
+_GL_FUNCDECL_SYS (logp1f, float, (float x));
+# endif
+_GL_CXXALIAS_SYS (logp1f, float, (float x));
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN1 (logp1f, float, (float x));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef logp1f
+# if HAVE_RAW_DECL_LOGP1F
+_GL_WARN_ON_USE (logp1f, "logp1f is unportable - "
+                 "use gnulib module logp1f for portability");
+# endif
+#endif
+
 #if @GNULIB_LOGP1@
 # if !@HAVE_LOGP1@
 _GL_FUNCDECL_SYS (logp1, double, (double x));
diff --git a/m4/isnand.m4 b/m4/isnand.m4
index 207407d361..7f7d88d859 100644
--- a/m4/isnand.m4
+++ b/m4/isnand.m4
@@ -1,5 +1,5 @@
 # isnand.m4
-# serial 14
+# serial 15
 dnl Copyright (C) 2007-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,
@@ -7,7 +7,7 @@
 
 dnl Check how to get or define isnand().
 
-AC_DEFUN([gl_FUNC_ISNAND],
+AC_DEFUN_ONCE([gl_FUNC_ISNAND],
 [
   AC_REQUIRE([gl_MATH_H_DEFAULTS])
   ISNAND_LIBM=
diff --git a/m4/log1p.m4 b/m4/log1p.m4
index cb7d5920ce..bd1c989b68 100644
--- a/m4/log1p.m4
+++ b/m4/log1p.m4
@@ -1,11 +1,11 @@
 # log1p.m4
-# serial 11
+# serial 12
 dnl Copyright (C) 2012-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,
 dnl with or without modifications, as long as this notice is preserved.
 
-AC_DEFUN([gl_FUNC_LOG1P],
+AC_DEFUN_ONCE([gl_FUNC_LOG1P],
 [
   m4_divert_text([DEFAULTS], [gl_log1p_required=plain])
   AC_REQUIRE([gl_MATH_H_DEFAULTS])
diff --git a/m4/logp1f.m4 b/m4/logp1f.m4
new file mode 100644
index 0000000000..d3d1c2db18
--- /dev/null
+++ b/m4/logp1f.m4
@@ -0,0 +1,31 @@
+# logp1f.m4
+# serial 1
+dnl Copyright (C) 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,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_FUNC_LOGP1F],
+[
+  AC_REQUIRE([gl_MATH_H_DEFAULTS])
+  AC_REQUIRE([gl_FUNC_LOGP1])
+
+  dnl Persuade glibc <math.h> to declare logp1f().
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+
+  dnl Test whether logp1f() exists. Assume that logp1f(), if it exists, is
+  dnl defined in the same library as logp1().
+  saved_LIBS="$LIBS"
+  LIBS="$LIBS $LOGP1_LIBM"
+  AC_CHECK_FUNCS([logp1f])
+  LIBS="$saved_LIBS"
+  if test $ac_cv_func_logp1f = yes; then
+    LOGP1F_LIBM="$LOGP1_LIBM"
+  else
+    HAVE_LOGP1F=0
+    dnl We implement logp1f through log1pf.
+    AC_REQUIRE([gl_FUNC_LOG1PF])
+    LOGP1F_LIBM="$LOG1PF_LIBM"
+  fi
+  AC_SUBST([LOGP1F_LIBM])
+])
diff --git a/m4/math_h.m4 b/m4/math_h.m4
index 8781c082df..49326068d0 100644
--- a/m4/math_h.m4
+++ b/m4/math_h.m4
@@ -1,5 +1,5 @@
 # math_h.m4
-# serial 139
+# serial 140
 dnl Copyright (C) 2007-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,
@@ -49,7 +49,7 @@ AC_DEFUN_ONCE([gl_MATH_H]
      ilogb ilogbf ilogbl
      ldexpf ldexpl
      log logf logl log10 log10f log10l log1p log1pf log1pl log2 log2f log2l
-     logb logbf logbl logp1
+     logb logbf logbl logp1 log1pf
      modf modff modfl powf
      remainder remainderf remainderl
      rint rintf rintl round roundf roundl
@@ -154,6 +154,7 @@ AC_DEFUN([gl_MATH_H_REQUIRE_DEFAULTS]
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGBF])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGBL])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGP1])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGP1F])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MODF])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MODFF])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MODFL])
@@ -255,6 +256,7 @@ AC_DEFUN([gl_MATH_H_DEFAULTS]
   HAVE_LOGBF=1;                     AC_SUBST([HAVE_LOGBF])
   HAVE_LOGBL=1;                     AC_SUBST([HAVE_LOGBL])
   HAVE_LOGP1=1;                     AC_SUBST([HAVE_LOGP1])
+  HAVE_LOGP1F=1;                    AC_SUBST([HAVE_LOGP1F])
   HAVE_MODFF=1;                     AC_SUBST([HAVE_MODFF])
   HAVE_MODFL=1;                     AC_SUBST([HAVE_MODFL])
   HAVE_POWF=1;                      AC_SUBST([HAVE_POWF])
diff --git a/modules/logp1f b/modules/logp1f
new file mode 100644
index 0000000000..cf72c20eb9
--- /dev/null
+++ b/modules/logp1f
@@ -0,0 +1,39 @@
+Description:
+logp1f() function: natural logarithm of argument plus 1.
+
+Files:
+lib/logp1f.c
+m4/logp1f.m4
+m4/logp1.m4
+m4/isnand.m4
+m4/log.m4
+m4/round.m4
+m4/floor.m4
+m4/ceil.m4
+m4/mathfunc.m4
+
+Depends-on:
+math
+log1pf          [test $HAVE_LOGP1F = 0]
+
+configure.ac:
+gl_FUNC_LOGP1F
+gl_CONDITIONAL([GL_COND_OBJ_LOGP1F], [test $HAVE_LOGP1F = 0])
+gl_MATH_MODULE_INDICATOR([logp1f])
+
+Makefile.am:
+if GL_COND_OBJ_LOGP1F
+lib_SOURCES += logp1f.c
+endif
+
+Include:
+<math.h>
+
+Link:
+$(LOGP1F_LIBM)
+
+License:
+LGPL
+
+Maintainer:
+all
diff --git a/modules/math b/modules/math
index fed10a5c5e..34c605c2f1 100644
--- a/modules/math
+++ b/modules/math
@@ -111,6 +111,7 @@ math.h: math.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(
 	      -e 's/@''GNULIB_LOGBF''@/$(GNULIB_LOGBF)/g' \
 	      -e 's/@''GNULIB_LOGBL''@/$(GNULIB_LOGBL)/g' \
 	      -e 's/@''GNULIB_LOGP1''@/$(GNULIB_LOGP1)/g' \
+	      -e 's/@''GNULIB_LOGP1F''@/$(GNULIB_LOGP1F)/g' \
 	      -e 's/@''GNULIB_MODF''@/$(GNULIB_MODF)/g' \
 	      -e 's/@''GNULIB_MODFF''@/$(GNULIB_MODFF)/g' \
 	      -e 's/@''GNULIB_MODFL''@/$(GNULIB_MODFL)/g' \
@@ -205,6 +206,7 @@ math.h: math.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(
 	      -e 's|@''HAVE_LOGBF''@|$(HAVE_LOGBF)|g' \
 	      -e 's|@''HAVE_LOGBL''@|$(HAVE_LOGBL)|g' \
 	      -e 's|@''HAVE_LOGP1''@|$(HAVE_LOGP1)|g' \
+	      -e 's|@''HAVE_LOGP1F''@|$(HAVE_LOGP1F)|g' \
 	      -e 's|@''HAVE_MODFF''@|$(HAVE_MODFF)|g' \
 	      -e 's|@''HAVE_MODFL''@|$(HAVE_MODFL)|g' \
 	      -e 's|@''HAVE_POWF''@|$(HAVE_POWF)|g' \
-- 
2.34.1

>From 63d2572d0872ca3e6c38025cbc289f43328e064b Mon Sep 17 00:00:00 2001
From: Bruno Haible <br...@clisp.org>
Date: Mon, 29 Jul 2024 13:19:33 +0200
Subject: [PATCH 4/6] logp1f: Add tests.

* tests/test-logp1f.c: New file, based on tests/test-log1pf.c.
* modules/logp1f-tests: New file.
---
 ChangeLog            |  4 ++++
 modules/logp1f-tests | 16 +++++++++++++++
 tests/test-logp1f.c  | 49 ++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 69 insertions(+)
 create mode 100644 modules/logp1f-tests
 create mode 100644 tests/test-logp1f.c

diff --git a/ChangeLog b/ChangeLog
index c16b3d27c7..7b2fd5ddf7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2024-07-29  Bruno Haible  <br...@clisp.org>
 
+	logp1f: Add tests.
+	* tests/test-logp1f.c: New file, based on tests/test-log1pf.c.
+	* modules/logp1f-tests: New file.
+
 	logp1f: New module.
 	* lib/math.in.h (logp1f): New declaration.
 	* lib/logp1f.c: New file.
diff --git a/modules/logp1f-tests b/modules/logp1f-tests
new file mode 100644
index 0000000000..e02fcaf3ea
--- /dev/null
+++ b/modules/logp1f-tests
@@ -0,0 +1,16 @@
+Files:
+tests/test-logp1f.c
+tests/test-log1p.h
+tests/signature.h
+tests/macros.h
+tests/randomf.c
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-logp1f
+check_PROGRAMS += test-logp1f
+test_logp1f_SOURCES = test-logp1f.c randomf.c
+test_logp1f_LDADD = $(LDADD) @LOGP1F_LIBM@
diff --git a/tests/test-logp1f.c b/tests/test-logp1f.c
new file mode 100644
index 0000000000..0c12ff9d1b
--- /dev/null
+++ b/tests/test-logp1f.c
@@ -0,0 +1,49 @@
+/* Test of logp1f() function.
+   Copyright (C) 2010-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <br...@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include <math.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (logp1f, float, (float));
+
+#include <float.h>
+
+#include "macros.h"
+
+#define DOUBLE float
+#define HUGEVAL HUGE_VALF
+#define L_(literal) literal##f
+#define MANT_DIG FLT_MANT_DIG
+#define LOG1P logp1f
+#define RANDOM randomf
+#include "test-log1p.h"
+
+int
+main ()
+{
+  /* A particular value.  */
+  x = 0.6f;
+  y = logp1f (x);
+  ASSERT (y >= 0.4700036f && y <= 0.4700037f);
+
+  test_function ();
+
+  return test_exit_status;
+}
-- 
2.34.1

>From 3f8e0614d0d3b1e364059963a3554b13bc28c687 Mon Sep 17 00:00:00 2001
From: Bruno Haible <br...@clisp.org>
Date: Mon, 29 Jul 2024 13:38:46 +0200
Subject: [PATCH 5/6] logp1l: New module.

* lib/math.in.h (logp1l): New declaration.
* lib/logp1l.c: New file.
* m4/logp1l.m4: New file.
* m4/math_h.m4 (gl_MATH_H): Test whether logp1l is declared.
(gl_MATH_H_REQUIRE_DEFAULTS): Initialize GNULIB_LOGP1L.
(gl_MATH_H_DEFAULTS): Initialize HAVE_LOGP1L.
* modules/math (Makefile.am): Substitute GNULIB_LOGP1L, HAVE_LOGP1L.
* modules/logp1l: New file.
* doc/posix-functions/logp1l.texi: Mention the new module.
---
 ChangeLog                       | 13 +++++++++++
 doc/posix-functions/logp1l.texi |  8 +++----
 lib/logp1l.c                    | 38 ++++++++++++++++++++++++++++++++
 lib/math.in.h                   | 16 ++++++++++++++
 m4/logp1l.m4                    | 32 +++++++++++++++++++++++++++
 m4/math_h.m4                    |  4 +++-
 modules/logp1l                  | 39 +++++++++++++++++++++++++++++++++
 modules/math                    |  2 ++
 8 files changed, 147 insertions(+), 5 deletions(-)
 create mode 100644 lib/logp1l.c
 create mode 100644 m4/logp1l.m4
 create mode 100644 modules/logp1l

diff --git a/ChangeLog b/ChangeLog
index 7b2fd5ddf7..01c967a194 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2024-07-29  Bruno Haible  <br...@clisp.org>
+
+	logp1l: New module.
+	* lib/math.in.h (logp1l): New declaration.
+	* lib/logp1l.c: New file.
+	* m4/logp1l.m4: New file.
+	* m4/math_h.m4 (gl_MATH_H): Test whether logp1l is declared.
+	(gl_MATH_H_REQUIRE_DEFAULTS): Initialize GNULIB_LOGP1L.
+	(gl_MATH_H_DEFAULTS): Initialize HAVE_LOGP1L.
+	* modules/math (Makefile.am): Substitute GNULIB_LOGP1L, HAVE_LOGP1L.
+	* modules/logp1l: New file.
+	* doc/posix-functions/logp1l.texi: Mention the new module.
+
 2024-07-29  Bruno Haible  <br...@clisp.org>
 
 	logp1f: Add tests.
diff --git a/doc/posix-functions/logp1l.texi b/doc/posix-functions/logp1l.texi
index 75c29287b1..569c8256b3 100644
--- a/doc/posix-functions/logp1l.texi
+++ b/doc/posix-functions/logp1l.texi
@@ -4,15 +4,15 @@
 
 ISO C23 specification:@* @url{http://www.open-std.org/jtc1/sc22/wg14/www/docs/n3220.pdf} section 7.12.6.14
 
-Gnulib module: ---
+Gnulib module: logp1l
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on all non-glibc platforms:
+glibc 2.39, macOS 14, FreeBSD 14.0, NetBSD 10.0, OpenBSD 7.5, Minix 3.3.0, AIX 7.3.1, HP-UX 11.31, Solaris 11.4, Cygwin 3.5.3, mingw, MSVC 14, Android.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
-@item
-This function is missing on all non-glibc platforms:
-glibc 2.39, macOS 14, FreeBSD 14.0, NetBSD 10.0, OpenBSD 7.5, Minix 3.3.0, AIX 7.3.1, HP-UX 11.31, Solaris 11.4, Cygwin 3.5.3, mingw, MSVC 14, Android.
 @end itemize
diff --git a/lib/logp1l.c b/lib/logp1l.c
new file mode 100644
index 0000000000..1cebbf71d7
--- /dev/null
+++ b/lib/logp1l.c
@@ -0,0 +1,38 @@
+/* Natural logarithm of argument plus 1.
+   Copyright (C) 2024 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation, either version 3 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <math.h>
+
+#if HAVE_SAME_LONG_DOUBLE_AS_DOUBLE
+
+long double
+logp1l (long double x)
+{
+  return logp1 (x);
+}
+
+#else
+
+long double
+logp1l (long double x)
+{
+  return log1pl (x);
+}
+
+#endif
diff --git a/lib/math.in.h b/lib/math.in.h
index cb99d9798e..c94ccb12ee 100644
--- a/lib/math.in.h
+++ b/lib/math.in.h
@@ -1891,6 +1891,22 @@ _GL_WARN_ON_USE (logp1, "logp1 is unportable - "
 # endif
 #endif
 
+#if @GNULIB_LOGP1L@
+# if !@HAVE_LOGP1L@
+_GL_FUNCDECL_SYS (logp1l, long double, (long double x));
+# endif
+_GL_CXXALIAS_SYS (logp1l, long double, (long double x));
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN1 (logp1l, long double, (long double x));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef logp1l
+# if HAVE_RAW_DECL_LOGP1L
+_GL_WARN_ON_USE (logp1l, "logp1l is unportable - "
+                 "use gnulib module logp1l for portability");
+# endif
+#endif
+
 
 #if @GNULIB_MODFF@
 # if @REPLACE_MODFF@
diff --git a/m4/logp1l.m4 b/m4/logp1l.m4
new file mode 100644
index 0000000000..1892af8b68
--- /dev/null
+++ b/m4/logp1l.m4
@@ -0,0 +1,32 @@
+# logp1l.m4
+# serial 1
+dnl Copyright (C) 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,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_FUNC_LOGP1L],
+[
+  AC_REQUIRE([gl_MATH_H_DEFAULTS])
+  AC_REQUIRE([gl_LONG_DOUBLE_VS_DOUBLE])
+  AC_REQUIRE([gl_FUNC_LOGP1])
+
+  dnl Persuade glibc <math.h> to declare logp1l().
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+
+  dnl Test whether logp1l() exists. Assume that logp1l(), if it exists, is
+  dnl defined in the same library as logp1().
+  saved_LIBS="$LIBS"
+  LIBS="$LIBS $LOGP1_LIBM"
+  AC_CHECK_FUNCS([logp1l])
+  LIBS="$saved_LIBS"
+  if test $ac_cv_func_logp1l = yes; then
+    LOGP1L_LIBM="$LOGP1_LIBM"
+  else
+    HAVE_LOGP1L=0
+    dnl We implement logp1l through log1pl.
+    AC_REQUIRE([gl_FUNC_LOG1PL])
+    LOGP1L_LIBM="$LOG1PL_LIBM"
+  fi
+  AC_SUBST([LOGP1L_LIBM])
+])
diff --git a/m4/math_h.m4 b/m4/math_h.m4
index 49326068d0..7e69629c3d 100644
--- a/m4/math_h.m4
+++ b/m4/math_h.m4
@@ -49,7 +49,7 @@ AC_DEFUN_ONCE([gl_MATH_H]
      ilogb ilogbf ilogbl
      ldexpf ldexpl
      log logf logl log10 log10f log10l log1p log1pf log1pl log2 log2f log2l
-     logb logbf logbl logp1 log1pf
+     logb logbf logbl logp1 log1pf logp1l
      modf modff modfl powf
      remainder remainderf remainderl
      rint rintf rintl round roundf roundl
@@ -155,6 +155,7 @@ AC_DEFUN([gl_MATH_H_REQUIRE_DEFAULTS]
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGBL])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGP1])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGP1F])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGP1L])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MODF])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MODFF])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MODFL])
@@ -257,6 +258,7 @@ AC_DEFUN([gl_MATH_H_DEFAULTS]
   HAVE_LOGBL=1;                     AC_SUBST([HAVE_LOGBL])
   HAVE_LOGP1=1;                     AC_SUBST([HAVE_LOGP1])
   HAVE_LOGP1F=1;                    AC_SUBST([HAVE_LOGP1F])
+  HAVE_LOGP1L=1;                    AC_SUBST([HAVE_LOGP1L])
   HAVE_MODFF=1;                     AC_SUBST([HAVE_MODFF])
   HAVE_MODFL=1;                     AC_SUBST([HAVE_MODFL])
   HAVE_POWF=1;                      AC_SUBST([HAVE_POWF])
diff --git a/modules/logp1l b/modules/logp1l
new file mode 100644
index 0000000000..55c3ac060d
--- /dev/null
+++ b/modules/logp1l
@@ -0,0 +1,39 @@
+Description:
+logp1l() function: natural logarithm of argument plus 1.
+
+Files:
+lib/logp1l.c
+m4/logp1l.m4
+m4/logp1.m4
+m4/isnand.m4
+m4/log.m4
+m4/round.m4
+m4/floor.m4
+m4/ceil.m4
+m4/mathfunc.m4
+
+Depends-on:
+math
+log1pl          [test $HAVE_LOGP1L = 0]
+
+configure.ac:
+gl_FUNC_LOGP1L
+gl_CONDITIONAL([GL_COND_OBJ_LOGP1L], [test $HAVE_LOGP1L = 0])
+gl_MATH_MODULE_INDICATOR([logp1l])
+
+Makefile.am:
+if GL_COND_OBJ_LOGP1L
+lib_SOURCES += logp1l.c
+endif
+
+Include:
+<math.h>
+
+Link:
+$(LOGP1L_LIBM)
+
+License:
+LGPL
+
+Maintainer:
+all
diff --git a/modules/math b/modules/math
index 34c605c2f1..f0cfa27374 100644
--- a/modules/math
+++ b/modules/math
@@ -112,6 +112,7 @@ math.h: math.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(
 	      -e 's/@''GNULIB_LOGBL''@/$(GNULIB_LOGBL)/g' \
 	      -e 's/@''GNULIB_LOGP1''@/$(GNULIB_LOGP1)/g' \
 	      -e 's/@''GNULIB_LOGP1F''@/$(GNULIB_LOGP1F)/g' \
+	      -e 's/@''GNULIB_LOGP1L''@/$(GNULIB_LOGP1L)/g' \
 	      -e 's/@''GNULIB_MODF''@/$(GNULIB_MODF)/g' \
 	      -e 's/@''GNULIB_MODFF''@/$(GNULIB_MODFF)/g' \
 	      -e 's/@''GNULIB_MODFL''@/$(GNULIB_MODFL)/g' \
@@ -207,6 +208,7 @@ math.h: math.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(
 	      -e 's|@''HAVE_LOGBL''@|$(HAVE_LOGBL)|g' \
 	      -e 's|@''HAVE_LOGP1''@|$(HAVE_LOGP1)|g' \
 	      -e 's|@''HAVE_LOGP1F''@|$(HAVE_LOGP1F)|g' \
+	      -e 's|@''HAVE_LOGP1L''@|$(HAVE_LOGP1L)|g' \
 	      -e 's|@''HAVE_MODFF''@|$(HAVE_MODFF)|g' \
 	      -e 's|@''HAVE_MODFL''@|$(HAVE_MODFL)|g' \
 	      -e 's|@''HAVE_POWF''@|$(HAVE_POWF)|g' \
-- 
2.34.1

>From 0dfbd9ecbf8de7aece51da7c6927073c7785375a Mon Sep 17 00:00:00 2001
From: Bruno Haible <br...@clisp.org>
Date: Mon, 29 Jul 2024 13:42:05 +0200
Subject: [PATCH 6/6] logp1l: Add tests.

* tests/test-logp1l.c: New file, based on tests/test-log1pl.c.
* modules/logp1l-tests: New file.
---
 ChangeLog            |  4 ++++
 modules/logp1l-tests | 18 +++++++++++++++
 tests/test-logp1l.c  | 54 ++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 76 insertions(+)
 create mode 100644 modules/logp1l-tests
 create mode 100644 tests/test-logp1l.c

diff --git a/ChangeLog b/ChangeLog
index 01c967a194..4edac54052 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2024-07-29  Bruno Haible  <br...@clisp.org>
 
+	logp1l: Add tests.
+	* tests/test-logp1l.c: New file, based on tests/test-log1pl.c.
+	* modules/logp1l-tests: New file.
+
 	logp1l: New module.
 	* lib/math.in.h (logp1l): New declaration.
 	* lib/logp1l.c: New file.
diff --git a/modules/logp1l-tests b/modules/logp1l-tests
new file mode 100644
index 0000000000..562b8c03c0
--- /dev/null
+++ b/modules/logp1l-tests
@@ -0,0 +1,18 @@
+Files:
+tests/test-logp1l.c
+tests/test-log1p.h
+tests/signature.h
+tests/macros.h
+tests/randoml.c
+
+Depends-on:
+fpucw
+float
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-logp1l
+check_PROGRAMS += test-logp1l
+test_logp1l_SOURCES = test-logp1l.c randoml.c
+test_logp1l_LDADD = $(LDADD) @LOGP1L_LIBM@
diff --git a/tests/test-logp1l.c b/tests/test-logp1l.c
new file mode 100644
index 0000000000..b7bf6c9d7f
--- /dev/null
+++ b/tests/test-logp1l.c
@@ -0,0 +1,54 @@
+/* Test of logp1l() function.
+   Copyright (C) 2010-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <br...@clisp.org>, 2010.  */
+
+#include <config.h>
+
+#include <math.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (logp1l, long double, (long double));
+
+#include <float.h>
+
+#include "fpucw.h"
+#include "macros.h"
+
+#define DOUBLE long double
+#define HUGEVAL HUGE_VALL
+#define L_(literal) literal##L
+#define MANT_DIG LDBL_MANT_DIG
+#define LOG1P logp1l
+#define RANDOM randoml
+#include "test-log1p.h"
+
+int
+main ()
+{
+  DECL_LONG_DOUBLE_ROUNDING
+
+  BEGIN_LONG_DOUBLE_ROUNDING ();
+
+  /* A particular value.  */
+  x = 0.6L;
+  y = logp1l (x);
+  ASSERT (y >= 0.4700036292L && y <= 0.4700036293L);
+
+  test_function ();
+
+  return test_exit_status;
+}
-- 
2.34.1

Reply via email to