summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2012-04-03 21:13:26 +0200
committerBruno Haible <bruno@clisp.org>2012-04-03 21:14:16 +0200
commitd6d7a9dc245badda81a34e336dda7baaeee78322 (patch)
tree3392d28d0bf27211ae246208ed2620f2c9deed42 /lib
parent2d538ff2c61e29c9a323b5e0f300ccc3610cebab (diff)
downloadgnulib-d6d7a9dc245badda81a34e336dda7baaeee78322.tar.gz
New module 'ilogbf'.
* lib/math.in.h (ilogbf): New declaration. * lib/ilogbf.c: New file. * m4/ilogbf.m4: New file. * m4/math_h.m4 (gl_MATH_H): Test whether ilogbf is declared. (gl_MATH_H_DEFAULTS): Initialize GNULIB_ILOGBF, HAVE_ILOGBF, REPLACE_ILOGBF. * modules/math (Makefile.am): Substitute GNULIB_ILOGBF, HAVE_ILOGBF, REPLACE_ILOGBF. * modules/ilogbf: New file. * tests/test-math-c++.cc: Check the declaration of ilogbf. * doc/posix-functions/ilogbf.texi: Mention the new module.
Diffstat (limited to 'lib')
-rw-r--r--lib/ilogbf.c23
-rw-r--r--lib/math.in.h23
2 files changed, 46 insertions, 0 deletions
diff --git a/lib/ilogbf.c b/lib/ilogbf.c
new file mode 100644
index 0000000000..d6403d0423
--- /dev/null
+++ b/lib/ilogbf.c
@@ -0,0 +1,23 @@
+/* Floating-point exponent.
+ Copyright (C) 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>
+
+#define USE_FLOAT
+#include "ilogb.c"
diff --git a/lib/math.in.h b/lib/math.in.h
index 83ba3476bc..74fca3a5e4 100644
--- a/lib/math.in.h
+++ b/lib/math.in.h
@@ -1087,6 +1087,29 @@ _GL_WARN_ON_USE (hypotl, "hypotl is unportable - "
#endif
+#if @GNULIB_ILOGBF@
+# if @REPLACE_ILOGBF@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef ilogbf
+# define ilogbf rpl_ilogbf
+# endif
+_GL_FUNCDECL_RPL (ilogbf, int, (float x));
+_GL_CXXALIAS_RPL (ilogbf, int, (float x));
+# else
+# if !@HAVE_ILOGBF@
+_GL_FUNCDECL_SYS (ilogbf, int, (float x));
+# endif
+_GL_CXXALIAS_SYS (ilogbf, int, (float x));
+# endif
+_GL_CXXALIASWARN (ilogbf);
+#elif defined GNULIB_POSIXCHECK
+# undef ilogbf
+# if HAVE_RAW_DECL_ILOGBF
+_GL_WARN_ON_USE (ilogbf, "ilogbf is unportable - "
+ "use gnulib module ilogbf for portability");
+# endif
+#endif
+
#if @GNULIB_ILOGB@
# if @REPLACE_ILOGB@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)