* lib/math.in.h (fmodf): New declaration.
* lib/fmodf.c: New file.
* m4/fmodf.m4: New file.
* m4/math_h.m4 (gl_MATH_H): Test whether fmodf is declared.
(gl_MATH_H_DEFAULTS): Initialize GNULIB_FMODF, HAVE_FMODF.
* modules/math (Makefile.am): Substitute GNULIB_FMODF, HAVE_FMODF.
* modules/fmodf: New file.
* tests/test-math-c++.cc: Check the declaration of fmodf.
* doc/posix-functions/fmodf.texi: Mention the new module.
2011-10-05 Bruno Haible <bruno@clisp.org>
+ New module 'fmodf'.
+ * lib/math.in.h (fmodf): New declaration.
+ * lib/fmodf.c: New file.
+ * m4/fmodf.m4: New file.
+ * m4/math_h.m4 (gl_MATH_H): Test whether fmodf is declared.
+ (gl_MATH_H_DEFAULTS): Initialize GNULIB_FMODF, HAVE_FMODF.
+ * modules/math (Makefile.am): Substitute GNULIB_FMODF, HAVE_FMODF.
+ * modules/fmodf: New file.
+ * tests/test-math-c++.cc: Check the declaration of fmodf.
+ * doc/posix-functions/fmodf.texi: Mention the new module.
+
fmod: Use a .m4 file.
* m4/fmod.m4: New file.
* modules/fmod (Files): Add it.
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
--- /dev/null
+/* Remainder.
+ 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
+fmodf (float x, float y)
+{
+ return (float) fmod ((double) x, (double) y);
+}
#endif
+#if @GNULIB_FMODF@
+# if !@HAVE_FMODF@
+# undef fmodf
+_GL_FUNCDECL_SYS (fmodf, float, (float x, float y));
+# endif
+_GL_CXXALIAS_SYS (fmodf, float, (float x, float y));
+_GL_CXXALIASWARN (fmodf);
+#elif defined GNULIB_POSIXCHECK
+# undef fmodf
+# if HAVE_RAW_DECL_FMODF
+_GL_WARN_ON_USE (fmodf, "fmodf is unportable - "
+ "use gnulib module fmodf for portability");
+# endif
+#endif
+
+
/* Write x as
x = mantissa * 2^exp
where
--- /dev/null
+# fmodf.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_FMODF],
+[
+ AC_REQUIRE([gl_MATH_H_DEFAULTS])
+ AC_REQUIRE([gl_FUNC_FMOD])
+
+ dnl Test whether fmodf() exists. Assume that fmodf(), if it exists, is
+ dnl defined in the same library as fmod().
+ save_LIBS="$LIBS"
+ LIBS="$LIBS $FMOD_LIBM"
+ AC_CHECK_FUNCS([fmodf])
+ LIBS="$save_LIBS"
+ if test $ac_cv_func_fmodf = yes; then
+ FMODF_LIBM="$FMOD_LIBM"
+ else
+ HAVE_FMODF=0
+ FMODF_LIBM="$FMOD_LIBM"
+ fi
+ AC_SUBST([FMODF_LIBM])
+])
-# math_h.m4 serial 26
+# math_h.m4 serial 27
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,
dnl Check for declarations of anything we want to poison if the
dnl corresponding gnulib module is not in use.
gl_WARN_ON_USE_PREPARE([[#include <math.h>]],
- [acosl asinl atanl ceilf ceill cosl expl fabsf floorf floorl frexpl
+ [acosl asinl atanl ceilf ceill cosl expl fabsf floorf floorl fmodf frexpl
ldexpl logb logl round roundf roundl sinl sqrtl tanl trunc truncf truncl])
])
GNULIB_FLOOR=0; AC_SUBST([GNULIB_FLOOR])
GNULIB_FLOORF=0; AC_SUBST([GNULIB_FLOORF])
GNULIB_FLOORL=0; AC_SUBST([GNULIB_FLOORL])
+ GNULIB_FMODF=0; AC_SUBST([GNULIB_FMODF])
GNULIB_FREXP=0; AC_SUBST([GNULIB_FREXP])
GNULIB_FREXPL=0; AC_SUBST([GNULIB_FREXPL])
GNULIB_ISFINITE=0; AC_SUBST([GNULIB_ISFINITE])
HAVE_COSL=1; AC_SUBST([HAVE_COSL])
HAVE_EXPL=1; AC_SUBST([HAVE_EXPL])
HAVE_FABSF=1; AC_SUBST([HAVE_FABSF])
+ HAVE_FMODF=1; AC_SUBST([HAVE_FMODF])
HAVE_ISNANF=1; AC_SUBST([HAVE_ISNANF])
HAVE_ISNAND=1; AC_SUBST([HAVE_ISNAND])
HAVE_ISNANL=1; AC_SUBST([HAVE_ISNANL])
--- /dev/null
+Description:
+fmodf() function: remainder.
+
+Files:
+lib/fmodf.c
+m4/fmodf.m4
+
+Depends-on:
+math
+fmod [test $HAVE_FMODF = 0]
+
+configure.ac:
+gl_FUNC_FMODF
+if test $HAVE_FMODF = 0; then
+ AC_LIBOBJ([fmodf])
+fi
+gl_MATH_MODULE_INDICATOR([fmodf])
+
+Makefile.am:
+
+Include:
+<math.h>
+
+Link:
+$(FMODF_LIBM)
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
-e 's/@''GNULIB_FLOOR''@/$(GNULIB_FLOOR)/g' \
-e 's/@''GNULIB_FLOORF''@/$(GNULIB_FLOORF)/g' \
-e 's/@''GNULIB_FLOORL''@/$(GNULIB_FLOORL)/g' \
+ -e 's/@''GNULIB_FMODF''@/$(GNULIB_FMODF)/g' \
-e 's/@''GNULIB_FREXP''@/$(GNULIB_FREXP)/g' \
-e 's/@''GNULIB_FREXPL''@/$(GNULIB_FREXPL)/g' \
-e 's/@''GNULIB_ISFINITE''@/$(GNULIB_ISFINITE)/g' \
-e 's|@''HAVE_COSL''@|$(HAVE_COSL)|g' \
-e 's|@''HAVE_EXPL''@|$(HAVE_EXPL)|g' \
-e 's|@''HAVE_FABSF''@|$(HAVE_FABSF)|g' \
+ -e 's|@''HAVE_FMODF''@|$(HAVE_FMODF)|g' \
-e 's|@''HAVE_ISNANF''@|$(HAVE_ISNANF)|g' \
-e 's|@''HAVE_ISNAND''@|$(HAVE_ISNAND)|g' \
-e 's|@''HAVE_ISNANL''@|$(HAVE_ISNANL)|g' \
SIGNATURE_CHECK (GNULIB_NAMESPACE::fabsf, float, (float));
#endif
//SIGNATURE_CHECK (GNULIB_NAMESPACE::fabs, double, (double));
+#if GNULIB_TEST_FMODF
+SIGNATURE_CHECK (GNULIB_NAMESPACE::fmodf, float, (float, float));
+#endif
//SIGNATURE_CHECK (GNULIB_NAMESPACE::fmod, double, (double, double));
#if GNULIB_TEST_FREXP
SIGNATURE_CHECK (GNULIB_NAMESPACE::frexp, double, (double, int *));