* 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-29 Bruno Haible <bruno@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 <bruno@clisp.org>
More updates regarding the 'Useable-in-testdir' sections.
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
--- /dev/null
+/* 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);
+}
#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)
--- /dev/null
+# 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])
+])
# 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,
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
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])
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])
--- /dev/null
+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
-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' \
-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' \