* lib/math.in.h (log10l): New declaration.
* lib/log10l.c: New file.
* m4/log10l.m4: New file.
* modules/log10l: New file.
* m4/math_h.m4 (gl_MATH_H): Test whether log10l is declared.
(gl_MATH_H_DEFAULTS): Initialize GNULIB_LOG10L, HAVE_LOG10L,
HAVE_DECL_LOG10L.
* modules/math (Makefile.am): Substitute GNULIB_LOG10L, HAVE_LOG10L,
HAVE_DECL_LOG10L.
* doc/posix-functions/log10l.texi: Mention the new module.
+2012-02-25 Bruno Haible <bruno@clisp.org>
+
+ New module 'log10l'.
+ * lib/math.in.h (log10l): New declaration.
+ * lib/log10l.c: New file.
+ * m4/log10l.m4: New file.
+ * modules/log10l: New file.
+ * m4/math_h.m4 (gl_MATH_H): Test whether log10l is declared.
+ (gl_MATH_H_DEFAULTS): Initialize GNULIB_LOG10L, HAVE_LOG10L,
+ HAVE_DECL_LOG10L.
+ * modules/math (Makefile.am): Substitute GNULIB_LOG10L, HAVE_LOG10L,
+ HAVE_DECL_LOG10L.
+ * doc/posix-functions/log10l.texi: Mention the new module.
+
2012-02-25 Bruno Haible <bruno@clisp.org>
fmodl, remainder*: Avoid wrong results due to rounding errors.
POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/log10l.html}
-Gnulib module: ---
+Gnulib module: log10l
Portability problems fixed by Gnulib:
@itemize
+@item
+This function is missing on some platforms:
+FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin, Interix 3.5, BeOS.
+@item
+This function is not declared on some platforms:
+AIX 5.1.
@end itemize
Portability problems not fixed by Gnulib:
@itemize
-@item
-This function is missing on some platforms:
-FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin, Interix 3.5, BeOS.
@end itemize
--- /dev/null
+/* Base 10 logarithmic function.
+ Copyright (C) 2012 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 <http://www.gnu.org/licenses/>. */
+
+#include <config.h>
+
+/* Specification. */
+#include <math.h>
+
+#if HAVE_SAME_LONG_DOUBLE_AS_DOUBLE
+
+long double
+log10l (long double x)
+{
+ return log10 (x);
+}
+
+#else
+
+/* 1 / log(10) */
+static const long double inv_log10 =
+ 0.43429448190325182765112891891660508229439700580366656611445378316586464920887L;
+
+long double
+log10l (long double x)
+{
+ return logl (x) * inv_log10;
+}
+
+#endif
# endif
#endif
+#if @GNULIB_LOG10L@
+# if !@HAVE_LOG10L@ || !@HAVE_DECL_LOG10L@
+# undef log10l
+_GL_FUNCDECL_SYS (log10l, long double, (long double x));
+# endif
+_GL_CXXALIAS_SYS (log10l, long double, (long double x));
+_GL_CXXALIASWARN (log10l);
+#elif defined GNULIB_POSIXCHECK
+# undef log10l
+# if HAVE_RAW_DECL_LOG10L
+_GL_WARN_ON_USE (log10l, "log10l is unportable - "
+ "use gnulib module log10l for portability");
+# endif
+#endif
+
#if @GNULIB_MODFF@
# if !@HAVE_MODFF@
--- /dev/null
+# log10l.m4 serial 1
+dnl Copyright (C) 2011-2012 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_LOG10L],
+[
+ AC_REQUIRE([gl_MATH_H_DEFAULTS])
+ AC_REQUIRE([gl_LONG_DOUBLE_VS_DOUBLE])
+ AC_REQUIRE([gl_FUNC_LOG10])
+
+ dnl Test whether log10l() is declared. On AIX 5.1 it is not declared.
+ AC_CHECK_DECL([log10l], , [HAVE_DECL_LOG10L=0], [[#include <math.h>]])
+
+ dnl Test whether log10l() exists. Assume that log10l(), if it exists, is
+ dnl defined in the same library as log10().
+ save_LIBS="$LIBS"
+ LIBS="$LIBS $LOG10_LIBM"
+ AC_CHECK_FUNCS([log10l])
+ LIBS="$save_LIBS"
+ if test $ac_cv_func_log10l = yes; then
+ LOG10L_LIBM="$LOG10_LIBM"
+ else
+ HAVE_LOG10L=0
+ if test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 1; then
+ LOG10L_LIBM="$LOG10_LIBM"
+ else
+ AC_REQUIRE([gl_FUNC_LOGL])
+ LOG10L_LIBM="$LOGL_LIBM"
+ fi
+ fi
+ AC_SUBST([LOG10L_LIBM])
+])
-# math_h.m4 serial 62
+# math_h.m4 serial 63
dnl Copyright (C) 2007-2012 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
[acosf acosl asinf asinl atanf atanl
ceilf ceill copysign copysignf copysignl cosf cosl coshf
expf expl fabsf fabsl floorf floorl fma fmaf fmal fmodf fmodl frexpf frexpl
- ldexpf ldexpl logb logf logl log10f modff modfl powf
+ ldexpf ldexpl logb logf logl log10f log10l modff modfl powf
remainder remainderf remainderl
rint rintf rintl round roundf roundl sinf sinl sinhf sqrtf sqrtl
tanf tanl tanhf trunc truncf truncl])
GNULIB_LOGF=0; AC_SUBST([GNULIB_LOGF])
GNULIB_LOGL=0; AC_SUBST([GNULIB_LOGL])
GNULIB_LOG10F=0; AC_SUBST([GNULIB_LOG10F])
+ GNULIB_LOG10L=0; AC_SUBST([GNULIB_LOG10L])
GNULIB_MODFF=0; AC_SUBST([GNULIB_MODFF])
GNULIB_MODFL=0; AC_SUBST([GNULIB_MODFL])
GNULIB_POWF=0; AC_SUBST([GNULIB_POWF])
HAVE_LOGF=1; AC_SUBST([HAVE_LOGF])
HAVE_LOGL=1; AC_SUBST([HAVE_LOGL])
HAVE_LOG10F=1; AC_SUBST([HAVE_LOG10F])
+ HAVE_LOG10L=1; AC_SUBST([HAVE_LOG10L])
HAVE_MODFF=1; AC_SUBST([HAVE_MODFF])
HAVE_MODFL=1; AC_SUBST([HAVE_MODFL])
HAVE_POWF=1; AC_SUBST([HAVE_POWF])
HAVE_DECL_LDEXPL=1; AC_SUBST([HAVE_DECL_LDEXPL])
HAVE_DECL_LOGB=1; AC_SUBST([HAVE_DECL_LOGB])
HAVE_DECL_LOGL=1; AC_SUBST([HAVE_DECL_LOGL])
+ HAVE_DECL_LOG10L=1; AC_SUBST([HAVE_DECL_LOG10L])
HAVE_DECL_REMAINDER=1; AC_SUBST([HAVE_DECL_REMAINDER])
HAVE_DECL_ROUND=1; AC_SUBST([HAVE_DECL_ROUND])
HAVE_DECL_ROUNDF=1; AC_SUBST([HAVE_DECL_ROUNDF])
--- /dev/null
+Description:
+log10l() function: base 10 logarithmic function.
+
+Files:
+lib/log10l.c
+m4/log10l.m4
+
+Depends-on:
+math
+log10 [test $HAVE_LOG10L = 0 && test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 1]
+logl [test $HAVE_LOG10L = 0 && test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 0]
+
+configure.ac:
+gl_FUNC_LOG10L
+if test $HAVE_LOG10L = 0; then
+ AC_LIBOBJ([log10l])
+fi
+gl_MATH_MODULE_INDICATOR([log10l])
+
+Makefile.am:
+
+Include:
+<math.h>
+
+Link:
+$(LOG10L_LIBM)
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
-e 's/@''GNULIB_LOGF''@/$(GNULIB_LOGF)/g' \
-e 's/@''GNULIB_LOGL''@/$(GNULIB_LOGL)/g' \
-e 's/@''GNULIB_LOG10F''@/$(GNULIB_LOG10F)/g' \
+ -e 's/@''GNULIB_LOG10L''@/$(GNULIB_LOG10L)/g' \
-e 's/@''GNULIB_MODFF''@/$(GNULIB_MODFF)/g' \
-e 's/@''GNULIB_MODFL''@/$(GNULIB_MODFL)/g' \
-e 's/@''GNULIB_POWF''@/$(GNULIB_POWF)/g' \
-e 's|@''HAVE_LOGF''@|$(HAVE_LOGF)|g' \
-e 's|@''HAVE_LOGL''@|$(HAVE_LOGL)|g' \
-e 's|@''HAVE_LOG10F''@|$(HAVE_LOG10F)|g' \
+ -e 's|@''HAVE_LOG10L''@|$(HAVE_LOG10L)|g' \
-e 's|@''HAVE_MODFF''@|$(HAVE_MODFF)|g' \
-e 's|@''HAVE_MODFL''@|$(HAVE_MODFL)|g' \
-e 's|@''HAVE_POWF''@|$(HAVE_POWF)|g' \
-e 's|@''HAVE_DECL_LDEXPL''@|$(HAVE_DECL_LDEXPL)|g' \
-e 's|@''HAVE_DECL_LOGB''@|$(HAVE_DECL_LOGB)|g' \
-e 's|@''HAVE_DECL_LOGL''@|$(HAVE_DECL_LOGL)|g' \
+ -e 's|@''HAVE_DECL_LOG10L''@|$(HAVE_DECL_LOG10L)|g' \
-e 's|@''HAVE_DECL_REMAINDER''@|$(HAVE_DECL_REMAINDER)|g' \
-e 's|@''HAVE_DECL_ROUND''@|$(HAVE_DECL_ROUND)|g' \
-e 's|@''HAVE_DECL_ROUNDF''@|$(HAVE_DECL_ROUNDF)|g' \