]> Savannah Git Hosting - gnulib.git/commitdiff
New module 'asinf'.
authorBruno Haible <bruno@clisp.org>
Sat, 8 Oct 2011 21:29:33 +0000 (23:29 +0200)
committerBruno Haible <bruno@clisp.org>
Sat, 8 Oct 2011 21:29:33 +0000 (23:29 +0200)
* lib/math.in.h (asinf): New declaration.
* lib/asinf.c: New file.
* m4/asinf.m4: New file.
* m4/math_h.m4 (gl_MATH_H): Test whether asinf is declared.
(gl_MATH_H_DEFAULTS): Initialize GNULIB_ASINF, HAVE_ASINF.
* modules/math (Makefile.am): Substitute GNULIB_ASINF, HAVE_ASINF.
* modules/asinf: New file.
* tests/test-math-c++.cc: Check the declaration of asinf.
* doc/posix-functions/asinf.texi: Mention the new module.

ChangeLog
doc/posix-functions/asinf.texi
lib/asinf.c [new file with mode: 0644]
lib/math.in.h
m4/asinf.m4 [new file with mode: 0644]
m4/math_h.m4
modules/asinf [new file with mode: 0644]
modules/math
tests/test-math-c++.cc

index ac1f0d9444ee46ae4714fa568dd3d2442c1193f0..772a27a9b0172a686dc143610d188c63ecd64a97 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
 2011-10-08  Bruno Haible  <bruno@clisp.org>
 
+       New module 'asinf'.
+       * lib/math.in.h (asinf): New declaration.
+       * lib/asinf.c: New file.
+       * m4/asinf.m4: New file.
+       * m4/math_h.m4 (gl_MATH_H): Test whether asinf is declared.
+       (gl_MATH_H_DEFAULTS): Initialize GNULIB_ASINF, HAVE_ASINF.
+       * modules/math (Makefile.am): Substitute GNULIB_ASINF, HAVE_ASINF.
+       * modules/asinf: New file.
+       * tests/test-math-c++.cc: Check the declaration of asinf.
+       * doc/posix-functions/asinf.texi: Mention the new module.
+
        asin: Use a .m4 file.
        * m4/asin.m4: New file.
        * modules/asin (Files): Add it.
index 999593b1b75dd9f1eda01e9c6114e08067d0699f..fbf532b898576c87ee45dba614778fdcc5598bc0 100644 (file)
@@ -4,14 +4,10 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/asinf.html}
 
-Gnulib module: ---
+Gnulib module: asinf
 
 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.
@@ -19,3 +15,7 @@ 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
diff --git a/lib/asinf.c b/lib/asinf.c
new file mode 100644 (file)
index 0000000..82f1d34
--- /dev/null
@@ -0,0 +1,26 @@
+/* Inverse sine 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
+asinf (float x)
+{
+  return (float) asin ((double) x);
+}
index 053774ea3266eed80454a608222caa3a40608ab6..a3c0d3133c62df759a66e35daad907fe69d047ef 100644 (file)
@@ -123,6 +123,21 @@ _GL_WARN_ON_USE (acosl, "acosl is unportable - "
 #endif
 
 
+#if @GNULIB_ASINF@
+# if !@HAVE_ASINF@
+#  undef asinf
+_GL_FUNCDECL_SYS (asinf, float, (float x));
+# endif
+_GL_CXXALIAS_SYS (asinf, float, (float x));
+_GL_CXXALIASWARN (asinf);
+#elif defined GNULIB_POSIXCHECK
+# undef asinf
+# if HAVE_RAW_DECL_ASINF
+_GL_WARN_ON_USE (asinf, "asinf is unportable - "
+                 "use gnulib module asinf for portability");
+# endif
+#endif
+
 #if @GNULIB_ASINL@
 # if !@HAVE_ASINL@ || !@HAVE_DECL_ASINL@
 _GL_FUNCDECL_SYS (asinl, long double, (long double x));
diff --git a/m4/asinf.m4 b/m4/asinf.m4
new file mode 100644 (file)
index 0000000..ad69aaf
--- /dev/null
@@ -0,0 +1,25 @@
+# asinf.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_ASINF],
+[
+  AC_REQUIRE([gl_MATH_H_DEFAULTS])
+  AC_REQUIRE([gl_FUNC_ASIN])
+
+  dnl Test whether asinf() exists. Assume that asinf(), if it exists, is
+  dnl defined in the same library as asin().
+  save_LIBS="$LIBS"
+  LIBS="$LIBS $ASIN_LIBM"
+  AC_CHECK_FUNCS([asinf])
+  LIBS="$save_LIBS"
+  if test $ac_cv_func_asinf = yes; then
+    ASINF_LIBM="$ASIN_LIBM"
+  else
+    HAVE_ASINF=0
+    ASINF_LIBM="$ASIN_LIBM"
+  fi
+  AC_SUBST([ASINF_LIBM])
+])
index 1a78358a3a761b05968f025e46270e3456aea255..a705f01843c4b1fe64e53bde0937b9c126f50370 100644 (file)
@@ -1,4 +1,4 @@
-# math_h.m4 serial 39
+# math_h.m4 serial 40
 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,
@@ -39,7 +39,7 @@ AC_DEFUN([gl_MATH_H],
   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 cosf cosl
+    [acosl asinf asinl atanl ceilf ceill cosf cosl
      expf expl fabsf floorf floorl fmodf frexpf frexpl
      ldexpf ldexpl logb logf logl log10f modff powf
      round roundf roundl sinf sinl sqrtf sqrtl
@@ -58,6 +58,7 @@ AC_DEFUN([gl_MATH_MODULE_INDICATOR],
 AC_DEFUN([gl_MATH_H_DEFAULTS],
 [
   GNULIB_ACOSL=0;    AC_SUBST([GNULIB_ACOSL])
+  GNULIB_ASINF=0;    AC_SUBST([GNULIB_ASINF])
   GNULIB_ASINL=0;    AC_SUBST([GNULIB_ASINL])
   GNULIB_ATANL=0;    AC_SUBST([GNULIB_ATANL])
   GNULIB_CEIL=0;     AC_SUBST([GNULIB_CEIL])
@@ -104,6 +105,7 @@ AC_DEFUN([gl_MATH_H_DEFAULTS],
   GNULIB_TRUNCL=0;   AC_SUBST([GNULIB_TRUNCL])
   dnl Assume proper GNU behavior unless another module says otherwise.
   HAVE_ACOSL=1;                AC_SUBST([HAVE_ACOSL])
+  HAVE_ASINF=1;                AC_SUBST([HAVE_ASINF])
   HAVE_ASINL=1;                AC_SUBST([HAVE_ASINL])
   HAVE_ATANL=1;                AC_SUBST([HAVE_ATANL])
   HAVE_COSF=1;                 AC_SUBST([HAVE_COSF])
diff --git a/modules/asinf b/modules/asinf
new file mode 100644 (file)
index 0000000..395ff2c
--- /dev/null
@@ -0,0 +1,31 @@
+Description:
+asinf() function: inverse sine function.
+
+Files:
+lib/asinf.c
+m4/asinf.m4
+
+Depends-on:
+math
+asin            [test $HAVE_ASINF = 0]
+
+configure.ac:
+gl_FUNC_ASINF
+if test $HAVE_ASINF = 0; then
+  AC_LIBOBJ([asinf])
+fi
+gl_MATH_MODULE_INDICATOR([asinf])
+
+Makefile.am:
+
+Include:
+<math.h>
+
+Link:
+$(ASINF_LIBM)
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
index 876ddc9d0c894761c128cbc09bd331cec21d2845..d005050af90cccb01db5c8617817132223969d17 100644 (file)
@@ -29,6 +29,7 @@ math.h: math.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(
              -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
              -e 's|@''NEXT_AS_FIRST_DIRECTIVE_MATH_H''@|$(NEXT_AS_FIRST_DIRECTIVE_MATH_H)|g' \
              -e 's/@''GNULIB_ACOSL''@/$(GNULIB_ACOSL)/g' \
+             -e 's/@''GNULIB_ASINF''@/$(GNULIB_ASINF)/g' \
              -e 's/@''GNULIB_ASINL''@/$(GNULIB_ASINL)/g' \
              -e 's/@''GNULIB_ATANL''@/$(GNULIB_ATANL)/g' \
              -e 's/@''GNULIB_CEIL''@/$(GNULIB_CEIL)/g' \
@@ -75,6 +76,7 @@ math.h: math.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(
              -e 's/@''GNULIB_TRUNCL''@/$(GNULIB_TRUNCL)/g' \
              < $(srcdir)/math.in.h | \
          sed -e 's|@''HAVE_ACOSL''@|$(HAVE_ACOSL)|g' \
+             -e 's|@''HAVE_ASINF''@|$(HAVE_ASINF)|g' \
              -e 's|@''HAVE_ASINL''@|$(HAVE_ASINL)|g' \
              -e 's|@''HAVE_ATANL''@|$(HAVE_ATANL)|g' \
              -e 's|@''HAVE_COSF''@|$(HAVE_COSF)|g' \
index a839f8f36b7ede2ef7c3838584fd13499f5650ca..4f82dd8f812c5109886837ada90c7a83047656e5 100644 (file)
@@ -25,6 +25,9 @@
 
 
 //SIGNATURE_CHECK (GNULIB_NAMESPACE::acos, double, (double));
+#if GNULIB_TEST_ASINF
+SIGNATURE_CHECK (GNULIB_NAMESPACE::asinf, float, (float));
+#endif
 //SIGNATURE_CHECK (GNULIB_NAMESPACE::asin, double, (double));
 //SIGNATURE_CHECK (GNULIB_NAMESPACE::atan, double, (double));
 //SIGNATURE_CHECK (GNULIB_NAMESPACE::atan2, double, (double, double));