* lib/math.in.h (exp2f): New declaration.
* lib/exp2f.c: New file.
* m4/exp2f.m4: New file.
* m4/math_h.m4 (gl_MATH_H): Test whether exp2f is declared.
(gl_MATH_H_DEFAULTS): Initialize GNULIB_EXP2F, HAVE_DECL_EXP2F.
* modules/math (Makefile.am): Substitute GNULIB_EXP2F, HAVE_DECL_EXP2F.
* modules/exp2f: New file.
* tests/test-math-c++.cc: Check the declaration of exp2f.
* doc/posix-functions/exp2f.texi: Mention the new module and the
IRIX problem.
+2012-03-08 Bruno Haible <bruno@clisp.org>
+
+ New module 'exp2f'.
+ * lib/math.in.h (exp2f): New declaration.
+ * lib/exp2f.c: New file.
+ * m4/exp2f.m4: New file.
+ * m4/math_h.m4 (gl_MATH_H): Test whether exp2f is declared.
+ (gl_MATH_H_DEFAULTS): Initialize GNULIB_EXP2F, HAVE_DECL_EXP2F.
+ * modules/math (Makefile.am): Substitute GNULIB_EXP2F, HAVE_DECL_EXP2F.
+ * modules/exp2f: New file.
+ * tests/test-math-c++.cc: Check the declaration of exp2f.
+ * doc/posix-functions/exp2f.texi: Mention the new module and the
+ IRIX problem.
+
2012-03-08 Bruno Haible <bruno@clisp.org>
Tests for module 'exp2'.
POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/exp2f.html}
-Gnulib module: ---
+Gnulib module: exp2f
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, older IRIX 6.5, OSF/1 4.0, Solaris 9, MSVC 9, Interix 3.5.
+@item
+This function is not declared on some platforms:
+IRIX 6.5.
@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, OSF/1 4.0, Solaris 9, MSVC 9, Interix 3.5.
@end itemize
--- /dev/null
+/* Exponential base 2 function.
+ Copyright (C) 2011-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>
+
+float
+exp2f (float x)
+{
+ return (float) exp2 ((double) x);
+}
#endif
+#if @GNULIB_EXP2F@
+# if !@HAVE_DECL_EXP2F@
+_GL_FUNCDECL_SYS (exp2f, float, (float x));
+# endif
+_GL_CXXALIAS_SYS (exp2f, float, (float x));
+_GL_CXXALIASWARN (exp2f);
+#elif defined GNULIB_POSIXCHECK
+# undef exp2f
+# if HAVE_RAW_DECL_EXP2F
+_GL_WARN_ON_USE (exp2f, "exp2f is unportable - "
+ "use gnulib module exp2f for portability");
+# endif
+#endif
+
#if @GNULIB_EXP2@
# if @REPLACE_EXP2@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
--- /dev/null
+# exp2f.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_EXP2F],
+[
+ AC_REQUIRE([gl_MATH_H_DEFAULTS])
+ AC_REQUIRE([gl_FUNC_EXP2])
+
+ dnl Persuade glibc <math.h> to declare exp2f().
+ AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+
+ dnl Test whether exp2f() exists. Assume that exp2f(), if it exists, is
+ dnl defined in the same library as exp2().
+ save_LIBS="$LIBS"
+ LIBS="$LIBS $EXP2_LIBM"
+ AC_CHECK_FUNCS([exp2f])
+ LIBS="$save_LIBS"
+ if test $ac_cv_func_exp2f = yes; then
+ HAVE_EXP2F=1
+ EXP2F_LIBM="$EXP2_LIBM"
+ dnl Also check whether it's declared.
+ dnl IRIX 6.5 has exp2f() in libm but doesn't declare it in <math.h>.
+ AC_CHECK_DECL([exp2f], , [HAVE_DECL_EXP2F=0], [[#include <math.h>]])
+ else
+ HAVE_EXP2F=0
+ HAVE_DECL_EXP2F=0
+ dnl Find libraries needed to link lib/exp2f.c.
+ EXP2F_LIBM="$EXP2_LIBM"
+ fi
+ AC_SUBST([EXP2F_LIBM])
+])
-# math_h.m4 serial 89
+# math_h.m4 serial 90
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,
gl_WARN_ON_USE_PREPARE([[#include <math.h>]],
[acosf acosl asinf asinl atanf atanl
cbrt cbrtf cbrtl ceilf ceill copysign copysignf copysignl cosf cosl coshf
- expf expl exp2 expm1 expm1f expm1l fabsf fabsl floorf floorl fma fmaf fmal
+ expf expl exp2 exp2f expm1 expm1f expm1l
+ fabsf fabsl floorf floorl fma fmaf fmal
fmod fmodf fmodl frexpf frexpl hypotf hypotl
ldexpf ldexpl logb logf logl log10f log10l modf modff modfl powf
remainder remainderf remainderl
GNULIB_EXPF=0; AC_SUBST([GNULIB_EXPF])
GNULIB_EXPL=0; AC_SUBST([GNULIB_EXPL])
GNULIB_EXP2=0; AC_SUBST([GNULIB_EXP2])
+ GNULIB_EXP2F=0; AC_SUBST([GNULIB_EXP2F])
GNULIB_EXPM1=0; AC_SUBST([GNULIB_EXPM1])
GNULIB_EXPM1F=0; AC_SUBST([GNULIB_EXPM1F])
GNULIB_EXPM1L=0; AC_SUBST([GNULIB_EXPM1L])
HAVE_DECL_COSL=1; AC_SUBST([HAVE_DECL_COSL])
HAVE_DECL_EXPL=1; AC_SUBST([HAVE_DECL_EXPL])
HAVE_DECL_EXP2=1; AC_SUBST([HAVE_DECL_EXP2])
+ HAVE_DECL_EXP2F=1; AC_SUBST([HAVE_DECL_EXP2F])
HAVE_DECL_EXPM1L=1; AC_SUBST([HAVE_DECL_EXPM1L])
HAVE_DECL_FLOORF=1; AC_SUBST([HAVE_DECL_FLOORF])
HAVE_DECL_FLOORL=1; AC_SUBST([HAVE_DECL_FLOORL])
--- /dev/null
+Description:
+exp2f() function: exponential base 2 function.
+
+Files:
+lib/exp2f.c
+m4/exp2f.m4
+
+Depends-on:
+math
+extensions
+exp2 [test $HAVE_EXP2F = 0]
+
+configure.ac:
+gl_FUNC_EXP2F
+if test $HAVE_EXP2F = 0; then
+ AC_LIBOBJ([exp2f])
+fi
+gl_MATH_MODULE_INDICATOR([exp2f])
+
+Makefile.am:
+
+Include:
+<math.h>
+
+Link:
+$(EXP2F_LIBM)
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
-e 's/@''GNULIB_EXPF''@/$(GNULIB_EXPF)/g' \
-e 's/@''GNULIB_EXPL''@/$(GNULIB_EXPL)/g' \
-e 's/@''GNULIB_EXP2''@/$(GNULIB_EXP2)/g' \
+ -e 's/@''GNULIB_EXP2F''@/$(GNULIB_EXP2F)/g' \
-e 's/@''GNULIB_EXPM1''@/$(GNULIB_EXPM1)/g' \
-e 's/@''GNULIB_EXPM1F''@/$(GNULIB_EXPM1F)/g' \
-e 's/@''GNULIB_EXPM1L''@/$(GNULIB_EXPM1L)/g' \
-e 's|@''HAVE_DECL_COSL''@|$(HAVE_DECL_COSL)|g' \
-e 's|@''HAVE_DECL_EXPL''@|$(HAVE_DECL_EXPL)|g' \
-e 's|@''HAVE_DECL_EXP2''@|$(HAVE_DECL_EXP2)|g' \
+ -e 's|@''HAVE_DECL_EXP2F''@|$(HAVE_DECL_EXP2F)|g' \
-e 's|@''HAVE_DECL_EXPM1L''@|$(HAVE_DECL_EXPM1L)|g' \
-e 's|@''HAVE_DECL_FLOORF''@|$(HAVE_DECL_FLOORF)|g' \
-e 's|@''HAVE_DECL_FLOORL''@|$(HAVE_DECL_FLOORL)|g' \
SIGNATURE_CHECK (GNULIB_NAMESPACE::expl, long double, (long double));
#endif
+#if GNULIB_TEST_EXP2F
+SIGNATURE_CHECK (GNULIB_NAMESPACE::exp2f, float, (float));
+#endif
#if GNULIB_TEST_EXP2
SIGNATURE_CHECK (GNULIB_NAMESPACE::exp2, double, (double));
#endif