* lib/math.in.h (tanf): New declaration.
* lib/tanf.c: New file.
* m4/tanf.m4: New file.
* m4/math_h.m4 (gl_MATH_H): Test whether tanf is declared.
(gl_MATH_H_DEFAULTS): Initialize GNULIB_TANF, HAVE_TANF.
* modules/math (Makefile.am): Substitute GNULIB_TANF, HAVE_TANF.
* modules/tanf: New file.
* tests/test-math-c++.cc: Check the declaration of tanf.
* doc/posix-functions/tanf.texi: Mention the new module.
2011-10-08 Bruno Haible <bruno@clisp.org>
+ New module 'tanf'.
+ * lib/math.in.h (tanf): New declaration.
+ * lib/tanf.c: New file.
+ * m4/tanf.m4: New file.
+ * m4/math_h.m4 (gl_MATH_H): Test whether tanf is declared.
+ (gl_MATH_H_DEFAULTS): Initialize GNULIB_TANF, HAVE_TANF.
+ * modules/math (Makefile.am): Substitute GNULIB_TANF, HAVE_TANF.
+ * modules/tanf: New file.
+ * tests/test-math-c++.cc: Check the declaration of tanf.
+ * doc/posix-functions/tanf.texi: Mention the new module.
+
tan: Use a .m4 file.
* m4/tan.m4: New file.
* modules/tan (Files): Add it.
POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/tanf.html}
-Gnulib module: ---
+Gnulib module: tanf
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_TANF@
+# if !@HAVE_TANF@
+# undef tanf
+_GL_FUNCDECL_SYS (tanf, float, (float x));
+# endif
+_GL_CXXALIAS_SYS (tanf, float, (float x));
+_GL_CXXALIASWARN (tanf);
+#elif defined GNULIB_POSIXCHECK
+# undef tanf
+# if HAVE_RAW_DECL_TANF
+_GL_WARN_ON_USE (tanf, "tanf is unportable - "
+ "use gnulib module tanf for portability");
+# endif
+#endif
+
#if @GNULIB_TANL@
# if !@HAVE_TANL@ || !@HAVE_DECL_TANL@
_GL_FUNCDECL_SYS (tanl, long double, (long double x));
--- /dev/null
+/* 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
+tanf (float x)
+{
+ return (float) tan ((double) x);
+}
-# math_h.m4 serial 38
+# math_h.m4 serial 39
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 sqrtf sqrtl
- tanl trunc truncf truncl])
+ tanf tanl trunc truncf truncl])
])
AC_DEFUN([gl_MATH_MODULE_INDICATOR],
GNULIB_SINL=0; AC_SUBST([GNULIB_SINL])
GNULIB_SQRTF=0; AC_SUBST([GNULIB_SQRTF])
GNULIB_SQRTL=0; AC_SUBST([GNULIB_SQRTL])
+ GNULIB_TANF=0; AC_SUBST([GNULIB_TANF])
GNULIB_TANL=0; AC_SUBST([GNULIB_TANL])
GNULIB_TRUNC=0; AC_SUBST([GNULIB_TRUNC])
GNULIB_TRUNCF=0; AC_SUBST([GNULIB_TRUNCF])
HAVE_SINL=1; AC_SUBST([HAVE_SINL])
HAVE_SQRTF=1; AC_SUBST([HAVE_SQRTF])
HAVE_SQRTL=1; AC_SUBST([HAVE_SQRTL])
+ HAVE_TANF=1; AC_SUBST([HAVE_TANF])
HAVE_TANL=1; AC_SUBST([HAVE_TANL])
HAVE_DECL_ACOSL=1; AC_SUBST([HAVE_DECL_ACOSL])
HAVE_DECL_ASINL=1; AC_SUBST([HAVE_DECL_ASINL])
--- /dev/null
+# tanf.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_TANF],
+[
+ AC_REQUIRE([gl_MATH_H_DEFAULTS])
+ AC_REQUIRE([gl_FUNC_TAN])
+
+ dnl Test whether tanf() exists. Assume that tanf(), if it exists, is
+ dnl defined in the same library as tan().
+ save_LIBS="$LIBS"
+ LIBS="$LIBS $TAN_LIBM"
+ AC_CHECK_FUNCS([tanf])
+ LIBS="$save_LIBS"
+ if test $ac_cv_func_tanf = yes; then
+ TANF_LIBM="$TAN_LIBM"
+ else
+ HAVE_TANF=0
+ TANF_LIBM="$TAN_LIBM"
+ fi
+ AC_SUBST([TANF_LIBM])
+])
-e 's/@''GNULIB_SINL''@/$(GNULIB_SINL)/g' \
-e 's/@''GNULIB_SQRTF''@/$(GNULIB_SQRTF)/g' \
-e 's/@''GNULIB_SQRTL''@/$(GNULIB_SQRTL)/g' \
+ -e 's/@''GNULIB_TANF''@/$(GNULIB_TANF)/g' \
-e 's/@''GNULIB_TANL''@/$(GNULIB_TANL)/g' \
-e 's/@''GNULIB_TRUNC''@/$(GNULIB_TRUNC)/g' \
-e 's/@''GNULIB_TRUNCF''@/$(GNULIB_TRUNCF)/g' \
-e 's|@''HAVE_SINL''@|$(HAVE_SINL)|g' \
-e 's|@''HAVE_SQRTF''@|$(HAVE_SQRTF)|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_DECL_ACOSL''@|$(HAVE_DECL_ACOSL)|g' \
-e 's|@''HAVE_DECL_ASINL''@|$(HAVE_DECL_ASINL)|g' \
--- /dev/null
+Description:
+tanf() function: tangent function.
+
+Files:
+lib/tanf.c
+m4/tanf.m4
+
+Depends-on:
+math
+tan [test $HAVE_TANF = 0]
+
+configure.ac:
+gl_FUNC_TANF
+if test $HAVE_TANF = 0; then
+ AC_LIBOBJ([tanf])
+fi
+gl_MATH_MODULE_INDICATOR([tanf])
+
+Makefile.am:
+
+Include:
+<math.h>
+
+Link:
+$(TANF_LIBM)
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
SIGNATURE_CHECK (GNULIB_NAMESPACE::sqrtf, float, (float));
#endif
//SIGNATURE_CHECK (GNULIB_NAMESPACE::sqrt, double, (double));
+#if GNULIB_TEST_TANF
+SIGNATURE_CHECK (GNULIB_NAMESPACE::tanf, float, (float));
+#endif
//SIGNATURE_CHECK (GNULIB_NAMESPACE::tan, double, (double));
//SIGNATURE_CHECK (GNULIB_NAMESPACE::tanh, double, (double));
//SIGNATURE_CHECK (GNULIB_NAMESPACE::y0, double, (double));