* lib/math.in.h (frexpf): New declaration.
* lib/frexpf.c: New file.
* m4/frexpf.m4: New file.
* m4/math_h.m4 (gl_MATH_H): Test whether frexpf is declared.
(gl_MATH_H_DEFAULTS): Initialize GNULIB_FREXPF, HAVE_FREXPF.
* modules/math (Makefile.am): Substitute GNULIB_FREXPF, HAVE_FREXPF.
* modules/frexpf: New file.
* tests/test-math-c++.cc: Check the declaration of frexpf.
* doc/posix-functions/frexpf.texi: Mention the new module.
+2011-10-06 Bruno Haible <bruno@clisp.org>
+
+ New module 'frexpf'.
+ * lib/math.in.h (frexpf): New declaration.
+ * lib/frexpf.c: New file.
+ * m4/frexpf.m4: New file.
+ * m4/math_h.m4 (gl_MATH_H): Test whether frexpf is declared.
+ (gl_MATH_H_DEFAULTS): Initialize GNULIB_FREXPF, HAVE_FREXPF.
+ * modules/math (Makefile.am): Substitute GNULIB_FREXPF, HAVE_FREXPF.
+ * modules/frexpf: New file.
+ * tests/test-math-c++.cc: Check the declaration of frexpf.
+ * doc/posix-functions/frexpf.texi: Mention the new module.
+
2011-10-06 Bruno Haible <bruno@clisp.org>
math: Sort function declarations of math.in.h.
POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/frexpf.html}
-Gnulib module: ---
+Gnulib module: frexpf
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, HP-UX 11, IRIX 6.5, 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
+/* Split a float into fraction and mantissa.
+ 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
+frexpf (float x, int *expptr)
+{
+ return (float) frexp ((double) x, expptr);
+}
#endif
+/* Write x as
+ x = mantissa * 2^exp
+ where
+ If x finite and nonzero: 0.5 <= |mantissa| < 1.0.
+ If x is zero: mantissa = x, exp = 0.
+ If x is infinite or NaN: mantissa = x, exp unspecified.
+ Store exp in *EXPPTR and return mantissa. */
+#if @GNULIB_FREXPF@
+# if !@HAVE_FREXPF@
+# undef frexpf
+_GL_FUNCDECL_SYS (frexpf, float, (float x, int *expptr) _GL_ARG_NONNULL ((2)));
+# endif
+_GL_CXXALIAS_SYS (frexpf, float, (float x, int *expptr));
+_GL_CXXALIASWARN (frexpf);
+#elif defined GNULIB_POSIXCHECK
+# undef frexpf
+# if HAVE_RAW_DECL_FREXPF
+_GL_WARN_ON_USE (frexpf, "frexpf is unportable - "
+ "use gnulib module frexpf for portability");
+# endif
+#endif
+
/* Write x as
x = mantissa * 2^exp
where
--- /dev/null
+# frexpf.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_FREXPF],
+[
+ AC_REQUIRE([gl_MATH_H_DEFAULTS])
+ AC_REQUIRE([gl_FUNC_FREXP])
+
+ dnl Test whether frexpf() exists. Assume that frexpf(), if it exists, is
+ dnl defined in the same library as frexp().
+ save_LIBS="$LIBS"
+ LIBS="$LIBS $FREXP_LIBM"
+ AC_CHECK_FUNCS([frexpf])
+ LIBS="$save_LIBS"
+ if test $ac_cv_func_frexpf = yes; then
+ FREXPF_LIBM="$FREXP_LIBM"
+ else
+ HAVE_FREXPF=0
+ FREXPF_LIBM="$FREXP_LIBM"
+ fi
+ AC_SUBST([FREXPF_LIBM])
+])
-# math_h.m4 serial 28
+# math_h.m4 serial 29
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 fmodf frexpl
+ [acosl asinl atanl ceilf ceill cosl expl fabsf floorf floorl fmodf
+ frexpf frexpl
ldexpl logb logl modff round roundf roundl sinl sqrtl
tanl trunc truncf truncl])
])
GNULIB_FLOORF=0; AC_SUBST([GNULIB_FLOORF])
GNULIB_FLOORL=0; AC_SUBST([GNULIB_FLOORL])
GNULIB_FMODF=0; AC_SUBST([GNULIB_FMODF])
+ GNULIB_FREXPF=0; AC_SUBST([GNULIB_FREXPF])
GNULIB_FREXP=0; AC_SUBST([GNULIB_FREXP])
GNULIB_FREXPL=0; AC_SUBST([GNULIB_FREXPL])
GNULIB_ISFINITE=0; AC_SUBST([GNULIB_ISFINITE])
HAVE_EXPL=1; AC_SUBST([HAVE_EXPL])
HAVE_FABSF=1; AC_SUBST([HAVE_FABSF])
HAVE_FMODF=1; AC_SUBST([HAVE_FMODF])
+ HAVE_FREXPF=1; AC_SUBST([HAVE_FREXPF])
HAVE_ISNANF=1; AC_SUBST([HAVE_ISNANF])
HAVE_ISNAND=1; AC_SUBST([HAVE_ISNAND])
HAVE_ISNANL=1; AC_SUBST([HAVE_ISNANL])
--- /dev/null
+Description:
+frexpf() function: split a float into its constituents.
+
+Files:
+lib/frexpf.c
+m4/frexpf.m4
+
+Depends-on:
+math
+frexp [test $HAVE_FREXPF = 0]
+
+configure.ac:
+gl_FUNC_FREXPF
+if test $HAVE_FREXPF = 0; then
+ AC_LIBOBJ([frexpf])
+fi
+gl_MATH_MODULE_INDICATOR([frexpf])
+
+Makefile.am:
+
+Include:
+<math.h>
+
+Link:
+$(FREXPF_LIBM)
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
-e 's/@''GNULIB_FLOORF''@/$(GNULIB_FLOORF)/g' \
-e 's/@''GNULIB_FLOORL''@/$(GNULIB_FLOORL)/g' \
-e 's/@''GNULIB_FMODF''@/$(GNULIB_FMODF)/g' \
+ -e 's/@''GNULIB_FREXPF''@/$(GNULIB_FREXPF)/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_EXPL''@|$(HAVE_EXPL)|g' \
-e 's|@''HAVE_FABSF''@|$(HAVE_FABSF)|g' \
-e 's|@''HAVE_FMODF''@|$(HAVE_FMODF)|g' \
+ -e 's|@''HAVE_FREXPF''@|$(HAVE_FREXPF)|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::fmodf, float, (float, float));
#endif
//SIGNATURE_CHECK (GNULIB_NAMESPACE::fmod, double, (double, double));
+#if GNULIB_TEST_FREXPF
+SIGNATURE_CHECK (GNULIB_NAMESPACE::frexpf, float, (float, int *));
+#endif
#if GNULIB_TEST_FREXP
SIGNATURE_CHECK (GNULIB_NAMESPACE::frexp, double, (double, int *));
#endif