* lib/math.in.h (tanhf): New declaration.
* lib/tanhf.c: New file.
* m4/tanhf.m4: New file.
* m4/math_h.m4 (gl_MATH_H): Test whether tanhf is declared.
(gl_MATH_H_DEFAULTS): Initialize GNULIB_TANHF, HAVE_TANHF.
* modules/math (Makefile.am): Substitute GNULIB_TANHF, HAVE_TANHF.
* modules/tanhf: New file.
* tests/test-math-c++.cc: Check the declaration of tanhf.
* doc/posix-functions/tanhf.texi: Mention the new module.
2011-10-08 Bruno Haible <bruno@clisp.org>
+ New module 'tanhf'.
+ * lib/math.in.h (tanhf): New declaration.
+ * lib/tanhf.c: New file.
+ * m4/tanhf.m4: New file.
+ * m4/math_h.m4 (gl_MATH_H): Test whether tanhf is declared.
+ (gl_MATH_H_DEFAULTS): Initialize GNULIB_TANHF, HAVE_TANHF.
+ * modules/math (Makefile.am): Substitute GNULIB_TANHF, HAVE_TANHF.
+ * modules/tanhf: New file.
+ * tests/test-math-c++.cc: Check the declaration of tanhf.
+ * doc/posix-functions/tanhf.texi: Mention the new module.
+
tanh: Use a .m4 file.
* m4/tanh.m4: New file.
* modules/tanh (Files): Add it.
POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/tanhf.html}
-Gnulib module: ---
+Gnulib module: tanhf
Portability problems fixed by Gnulib:
@itemize
-@end itemize
-
-Portability problems not fixed by Gnulib:
-@itemize
@item
This function is missing on some platforms:
Minix 3.1.8, AIX 5.1, Solaris 9.
This function is only defined as a macro with arguments on some platforms:
MSVC 9.
@end itemize
+
+Portability problems not fixed by Gnulib:
+@itemize
+@end itemize
#endif
+#if @GNULIB_TANHF@
+# if !@HAVE_TANHF@
+# undef tanhf
+_GL_FUNCDECL_SYS (tanhf, float, (float x));
+# endif
+_GL_CXXALIAS_SYS (tanhf, float, (float x));
+_GL_CXXALIASWARN (tanhf);
+#elif defined GNULIB_POSIXCHECK
+# undef tanhf
+# if HAVE_RAW_DECL_TANHF
+_GL_WARN_ON_USE (tanhf, "tanhf is unportable - "
+ "use gnulib module tanhf for portability");
+# endif
+#endif
+
+
#if @GNULIB_TRUNCF@
# if @REPLACE_TRUNCF@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
--- /dev/null
+/* Hyperbolic tangent function.
+ Copyright (C) 2011 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
+tanhf (float x)
+{
+ return (float) tanh ((double) x);
+}
-# math_h.m4 serial 45
+# math_h.m4 serial 46
dnl Copyright (C) 2007-2011 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 fabsf floorf floorl fmodf frexpf frexpl
ldexpf ldexpl logb logf logl log10f modff powf
round roundf roundl sinf sinl sinhf sqrtf sqrtl
- tanf tanl trunc truncf truncl])
+ tanf tanl tanhf trunc truncf truncl])
])
AC_DEFUN([gl_MATH_MODULE_INDICATOR],
GNULIB_SQRTL=0; AC_SUBST([GNULIB_SQRTL])
GNULIB_TANF=0; AC_SUBST([GNULIB_TANF])
GNULIB_TANL=0; AC_SUBST([GNULIB_TANL])
+ GNULIB_TANHF=0; AC_SUBST([GNULIB_TANHF])
GNULIB_TRUNC=0; AC_SUBST([GNULIB_TRUNC])
GNULIB_TRUNCF=0; AC_SUBST([GNULIB_TRUNCF])
GNULIB_TRUNCL=0; AC_SUBST([GNULIB_TRUNCL])
HAVE_SQRTL=1; AC_SUBST([HAVE_SQRTL])
HAVE_TANF=1; AC_SUBST([HAVE_TANF])
HAVE_TANL=1; AC_SUBST([HAVE_TANL])
+ HAVE_TANHF=1; AC_SUBST([HAVE_TANHF])
HAVE_DECL_ACOSL=1; AC_SUBST([HAVE_DECL_ACOSL])
HAVE_DECL_ASINL=1; AC_SUBST([HAVE_DECL_ASINL])
HAVE_DECL_ATANL=1; AC_SUBST([HAVE_DECL_ATANL])
--- /dev/null
+# tanhf.m4 serial 1
+dnl Copyright (C) 2011 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_TANHF],
+[
+ AC_REQUIRE([gl_MATH_H_DEFAULTS])
+ AC_REQUIRE([gl_FUNC_TANH])
+
+ dnl Test whether tanhf() exists. Assume that tanhf(), if it exists, is
+ dnl defined in the same library as tanh().
+ save_LIBS="$LIBS"
+ LIBS="$LIBS $TANH_LIBM"
+ AC_CHECK_FUNCS([tanhf])
+ LIBS="$save_LIBS"
+ if test $ac_cv_func_tanhf = yes; then
+ TANHF_LIBM="$TANH_LIBM"
+ else
+ HAVE_TANHF=0
+ TANHF_LIBM="$TANH_LIBM"
+ fi
+ AC_SUBST([TANHF_LIBM])
+])
-e 's/@''GNULIB_SQRTL''@/$(GNULIB_SQRTL)/g' \
-e 's/@''GNULIB_TANF''@/$(GNULIB_TANF)/g' \
-e 's/@''GNULIB_TANL''@/$(GNULIB_TANL)/g' \
+ -e 's/@''GNULIB_TANHF''@/$(GNULIB_TANHF)/g' \
-e 's/@''GNULIB_TRUNC''@/$(GNULIB_TRUNC)/g' \
-e 's/@''GNULIB_TRUNCF''@/$(GNULIB_TRUNCF)/g' \
-e 's/@''GNULIB_TRUNCL''@/$(GNULIB_TRUNCL)/g' \
-e 's|@''HAVE_SQRTL''@|$(HAVE_SQRTL)|g' \
-e 's|@''HAVE_TANF''@|$(HAVE_TANF)|g' \
-e 's|@''HAVE_TANL''@|$(HAVE_TANL)|g' \
+ -e 's|@''HAVE_TANHF''@|$(HAVE_TANHF)|g' \
-e 's|@''HAVE_DECL_ACOSL''@|$(HAVE_DECL_ACOSL)|g' \
-e 's|@''HAVE_DECL_ASINL''@|$(HAVE_DECL_ASINL)|g' \
-e 's|@''HAVE_DECL_ATANL''@|$(HAVE_DECL_ATANL)|g' \
--- /dev/null
+Description:
+tanhf() function: hyperbolic tangent function.
+
+Files:
+lib/tanhf.c
+m4/tanhf.m4
+
+Depends-on:
+math
+tanh [test $HAVE_TANHF = 0]
+
+configure.ac:
+gl_FUNC_TANHF
+if test $HAVE_TANHF = 0; then
+ AC_LIBOBJ([tanhf])
+fi
+gl_MATH_MODULE_INDICATOR([tanhf])
+
+Makefile.am:
+
+Include:
+<math.h>
+
+Link:
+$(TANHF_LIBM)
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
SIGNATURE_CHECK (GNULIB_NAMESPACE::tanf, float, (float));
#endif
//SIGNATURE_CHECK (GNULIB_NAMESPACE::tan, double, (double));
+#if GNULIB_TEST_TANHF
+SIGNATURE_CHECK (GNULIB_NAMESPACE::tanhf, float, (float));
+#endif
//SIGNATURE_CHECK (GNULIB_NAMESPACE::tanh, double, (double));
//SIGNATURE_CHECK (GNULIB_NAMESPACE::y0, double, (double));
//SIGNATURE_CHECK (GNULIB_NAMESPACE::y1, double, (double));