* lib/math.in.h (ilogbl): New declaration.
* lib/ilogbl.c: New file.
* m4/ilogbl.m4: New file.
* m4/math_h.m4 (gl_MATH_H): Test whether ilogbl is declared.
(gl_MATH_H_DEFAULTS): Initialize GNULIB_ILOGBL, HAVE_ILOGBL.
* modules/math (Makefile.am): Substitute GNULIB_ILOGBL, HAVE_ILOGBL.
Split sed invocation, to avoid the limit of 100 substitutions of
HP-UX 'sed'.
* modules/ilogbl: New file.
* tests/test-math-c++.cc: Check the declaration of ilogbl.
* doc/posix-functions/ilogbl.texi: Mention the new module.
+2012-04-03 Bruno Haible <bruno@clisp.org>
+
+ New module 'ilogbl'.
+ * lib/math.in.h (ilogbl): New declaration.
+ * lib/ilogbl.c: New file.
+ * m4/ilogbl.m4: New file.
+ * m4/math_h.m4 (gl_MATH_H): Test whether ilogbl is declared.
+ (gl_MATH_H_DEFAULTS): Initialize GNULIB_ILOGBL, HAVE_ILOGBL.
+ * modules/math (Makefile.am): Substitute GNULIB_ILOGBL, HAVE_ILOGBL.
+ Split sed invocation, to avoid the limit of 100 substitutions of
+ HP-UX 'sed'.
+ * modules/ilogbl: New file.
+ * tests/test-math-c++.cc: Check the declaration of ilogbl.
+ * doc/posix-functions/ilogbl.texi: Mention the new module.
+
2012-04-03 Bruno Haible <bruno@clisp.org>
Tests for module 'ilogbf'.
POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/ilogbl.html}
-Gnulib module: ---
+Gnulib module: ilogbl
Portability problems fixed by Gnulib:
@itemize
+@item
+This function is missing on some platforms:
+FreeBSD 5.2.1, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin, MSVC 9, Interix 3.5, BeOS.
@end itemize
Portability problems not fixed by Gnulib:
@itemize
-@item
-This function is missing on some platforms:
-FreeBSD 5.2.1, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin, MSVC 9, Interix 3.5, BeOS.
@end itemize
--- /dev/null
+/* Floating-point exponent.
+ 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
+
+int
+ilogbl (long double x)
+{
+ return ilogb (x);
+}
+
+#else
+
+# define USE_LONG_DOUBLE
+# include "ilogb.c"
+
+#endif
# endif
#endif
+#if @GNULIB_ILOGBL@
+# if !@HAVE_ILOGBL@
+_GL_FUNCDECL_SYS (ilogbl, int, (long double x));
+# endif
+_GL_CXXALIAS_SYS (ilogbl, int, (long double x));
+_GL_CXXALIASWARN (ilogbl);
+#elif defined GNULIB_POSIXCHECK
+# undef ilogbl
+# if HAVE_RAW_DECL_ILOGBL
+_GL_WARN_ON_USE (ilogbl, "ilogbl is unportable - "
+ "use gnulib module ilogbl for portability");
+# endif
+#endif
+
/* Return x * 2^exp. */
#if @GNULIB_LDEXPF@
--- /dev/null
+# ilogbl.m4 serial 1
+dnl Copyright (C) 2010-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_ILOGBL],
+[
+ AC_REQUIRE([gl_MATH_H_DEFAULTS])
+ AC_REQUIRE([gl_LONG_DOUBLE_VS_DOUBLE])
+ AC_REQUIRE([gl_FUNC_ILOGB])
+
+ dnl Persuade glibc <math.h> to declare ilogbl().
+ AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+
+ dnl Test whether ilogbl() exists. Assume that ilogbl(), if it exists, is
+ dnl defined in the same library as ilogb().
+ save_LIBS="$LIBS"
+ LIBS="$LIBS $ILOGB_LIBM"
+ AC_CACHE_CHECK([for ilogbl],
+ [gl_cv_func_ilogbl],
+ [
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#ifndef __NO_MATH_INLINES
+ # define __NO_MATH_INLINES 1 /* for glibc */
+ #endif
+ #include <math.h>
+ int (*funcptr) (long double) = ilogbl;
+ long double x;]],
+ [[return (funcptr (x) % 2) == 0
+ || (ilogbl (x) % 2) == 0;]])],
+ [gl_cv_func_ilogbl=yes],
+ [gl_cv_func_ilogbl=no])
+ ])
+ LIBS="$save_LIBS"
+ if test $gl_cv_func_ilogbl = yes; then
+ ILOGBL_LIBM="$ILOGB_LIBM"
+ else
+ HAVE_ILOGBL=0
+ dnl Find libraries needed to link lib/ilogbl.c.
+ if test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 1; then
+ ILOGBL_LIBM="$ILOGB_LIBM"
+ else
+ AC_REQUIRE([gl_FUNC_FREXPL])
+ AC_REQUIRE([gl_FUNC_ISNANL])
+ ILOGBL_LIBM=
+ dnl Append $FREXPL_LIBM to ILOGBL_LIBM, avoiding gratuitous duplicates.
+ case " $ILOGBL_LIBM " in
+ *" $FREXPL_LIBM "*) ;;
+ *) ILOGBL_LIBM="$ILOGBL_LIBM $FREXPL_LIBM" ;;
+ esac
+ dnl Append $ISNANL_LIBM to ILOGBL_LIBM, avoiding gratuitous duplicates.
+ case " $ILOGBL_LIBM " in
+ *" $ISNANL_LIBM "*) ;;
+ *) ILOGBL_LIBM="$ILOGBL_LIBM $ISNANL_LIBM" ;;
+ esac
+ fi
+ fi
+ AC_SUBST([ILOGBL_LIBM])
+])
-# math_h.m4 serial 112
+# math_h.m4 serial 113
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,
expf expl exp2 exp2f exp2l expm1 expm1f expm1l
fabsf fabsl floorf floorl fma fmaf fmal
fmod fmodf fmodl frexpf frexpl hypotf hypotl
- ilogb ilogbf
+ ilogb ilogbf ilogbl
ldexpf ldexpl
log logf logl log10 log10f log10l log1p log1pf log1pl log2 log2f log2l
logb logbf logbl
GNULIB_HYPOTL=0; AC_SUBST([GNULIB_HYPOTL])
GNULIB_ILOGB=0; AC_SUBST([GNULIB_ILOGB])
GNULIB_ILOGBF=0; AC_SUBST([GNULIB_ILOGBF])
+ GNULIB_ILOGBL=0; AC_SUBST([GNULIB_ILOGBL])
GNULIB_ISFINITE=0; AC_SUBST([GNULIB_ISFINITE])
GNULIB_ISINF=0; AC_SUBST([GNULIB_ISINF])
GNULIB_ISNAN=0; AC_SUBST([GNULIB_ISNAN])
HAVE_HYPOTL=1; AC_SUBST([HAVE_HYPOTL])
HAVE_ILOGB=1; AC_SUBST([HAVE_ILOGB])
HAVE_ILOGBF=1; AC_SUBST([HAVE_ILOGBF])
+ HAVE_ILOGBL=1; AC_SUBST([HAVE_ILOGBL])
HAVE_ISNANF=1; AC_SUBST([HAVE_ISNANF])
HAVE_ISNAND=1; AC_SUBST([HAVE_ISNAND])
HAVE_ISNANL=1; AC_SUBST([HAVE_ISNANL])
--- /dev/null
+Description:
+ilogbl() function: get exponent as integer.
+
+Files:
+lib/ilogbl.c
+lib/ilogb.c
+m4/ilogbl.m4
+m4/mathfunc.m4
+
+Depends-on:
+math
+extensions
+ilogb [test $HAVE_ILOGBL = 0 && test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 1]
+isfinite [test $HAVE_ILOGBL = 0 && test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 0]
+frexpl [test $HAVE_ILOGBL = 0 && test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 0]
+isnanl [test $HAVE_ILOGBL = 0 && test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 0]
+
+configure.ac:
+gl_FUNC_ILOGBL
+if test $HAVE_ILOGBL = 0; then
+ AC_LIBOBJ([ilogbl])
+fi
+gl_MATH_MODULE_INDICATOR([ilogbl])
+
+Makefile.am:
+
+Include:
+<math.h>
+
+Link:
+$(ILOGBL_LIBM)
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
-e 's/@''GNULIB_HYPOT''@/$(GNULIB_HYPOT)/g' \
-e 's/@''GNULIB_HYPOTF''@/$(GNULIB_HYPOTF)/g' \
-e 's/@''GNULIB_HYPOTL''@/$(GNULIB_HYPOTL)/g' \
- -e 's/@''GNULIB_ILOGB''@/$(GNULIB_ILOGB)/g' \
+ < $(srcdir)/math.in.h | \
+ sed -e 's/@''GNULIB_ILOGB''@/$(GNULIB_ILOGB)/g' \
-e 's/@''GNULIB_ILOGBF''@/$(GNULIB_ILOGBF)/g' \
+ -e 's/@''GNULIB_ILOGBL''@/$(GNULIB_ILOGBL)/g' \
-e 's/@''GNULIB_ISFINITE''@/$(GNULIB_ISFINITE)/g' \
-e 's/@''GNULIB_ISINF''@/$(GNULIB_ISINF)/g' \
-e 's/@''GNULIB_ISNAN''@/$(GNULIB_ISNAN)/g' \
-e 's/@''GNULIB_TRUNC''@/$(GNULIB_TRUNC)/g' \
-e 's/@''GNULIB_TRUNCF''@/$(GNULIB_TRUNCF)/g' \
-e 's/@''GNULIB_TRUNCL''@/$(GNULIB_TRUNCL)/g' \
- < $(srcdir)/math.in.h | \
+ | \
sed -e 's|@''HAVE_ACOSF''@|$(HAVE_ACOSF)|g' \
-e 's|@''HAVE_ACOSL''@|$(HAVE_ACOSL)|g' \
-e 's|@''HAVE_ASINF''@|$(HAVE_ASINF)|g' \
-e 's|@''HAVE_HYPOTL''@|$(HAVE_HYPOTL)|g' \
-e 's|@''HAVE_ILOGB''@|$(HAVE_ILOGB)|g' \
-e 's|@''HAVE_ILOGBF''@|$(HAVE_ILOGBF)|g' \
+ -e 's|@''HAVE_ILOGBL''@|$(HAVE_ILOGBL)|g' \
-e 's|@''HAVE_ISNANF''@|$(HAVE_ISNANF)|g' \
-e 's|@''HAVE_ISNAND''@|$(HAVE_ISNAND)|g' \
-e 's|@''HAVE_ISNANL''@|$(HAVE_ISNANL)|g' \
#if GNULIB_TEST_ILOGB
SIGNATURE_CHECK (GNULIB_NAMESPACE::ilogb, int, (double));
#endif
+#if GNULIB_TEST_ILOGBL
+SIGNATURE_CHECK (GNULIB_NAMESPACE::ilogbl, int, (long double));
+#endif
//SIGNATURE_CHECK (GNULIB_NAMESPACE::j0, double, (double));