* m4/log1pf-ieee.m4: New file.
* m4/log1pf.m4 (gl_FUNC_LOG1PF): If gl_FUNC_LOG1PF_IEEE is present,
test whether log1pf works with a minus zero argument. Replace it if
not.
* modules/log1pf-ieee (Files): Add m4/log1pf-ieee.m4, m4/minus-zero.m4,
m4/signbit.m4.
(configure.ac): Invoke gl_FUNC_LOG1PF_IEEE.
* doc/posix-functions/log1pf.texi: Mention the log1pf-ieee module.
2012-03-10 Bruno Haible <bruno@clisp.org>
+ log1pf-ieee: Work around test failure on OpenBSD 4.9 and AIX 7.1.
+ * m4/log1pf-ieee.m4: New file.
+ * m4/log1pf.m4 (gl_FUNC_LOG1PF): If gl_FUNC_LOG1PF_IEEE is present,
+ test whether log1pf works with a minus zero argument. Replace it if
+ not.
+ * modules/log1pf-ieee (Files): Add m4/log1pf-ieee.m4, m4/minus-zero.m4,
+ m4/signbit.m4.
+ (configure.ac): Invoke gl_FUNC_LOG1PF_IEEE.
+ * doc/posix-functions/log1pf.texi: Mention the log1pf-ieee module.
+
log1pf-ieee: Work around test failure on AIX 5.1 and HP-UX 11.
* modules/log1pf-ieee (Depends-on): Add log1p-ieee.
(configure.ac): Require gl_FUNC_LOG1PF.
POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/log1pf.html}
-Gnulib module: log1pf
+Gnulib module: log1pf or log1pf-ieee
-Portability problems fixed by Gnulib:
+Portability problems fixed by either Gnulib module @code{log1pf} or @code{log1pf-ieee}:
@itemize
@item
This function is missing on some platforms:
IRIX 6.5.
@end itemize
+Portability problems fixed by Gnulib module @code{log1pf-ieee}:
+@itemize
+@item
+This function has problems when the argument is minus zero on some platforms:
+OpenBSD 4.9, AIX 7.1.
+@end itemize
+
Portability problems not fixed by Gnulib:
@itemize
@end itemize
--- /dev/null
+# log1pf-ieee.m4 serial 1
+dnl Copyright (C) 2012 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.
+
+dnl This macro is in a separate file (not in remainder.m4 and not inlined in the
+dnl module description), so that gl_FUNC_LOG1PF can test whether 'aclocal' has
+dnl found uses of this macro.
+
+AC_DEFUN([gl_FUNC_LOG1PF_IEEE],
+[
+ m4_divert_text([INIT_PREPARE], [gl_log1pf_required=ieee])
+ AC_REQUIRE([gl_FUNC_LOG1PF])
+])
-# log1pf.m4 serial 1
+# log1pf.m4 serial 2
dnl Copyright (C) 2012 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
AC_DEFUN([gl_FUNC_LOG1PF],
[
+ m4_divert_text([DEFAULTS], [gl_log1pf_required=plain])
AC_REQUIRE([gl_MATH_H_DEFAULTS])
AC_REQUIRE([gl_FUNC_LOG1P])
*yes) ;;
*) REPLACE_LOG1PF=1 ;;
esac
+
+ m4_ifdef([gl_FUNC_LOG1PF_IEEE], [
+ if test $gl_log1pf_required = ieee && test $REPLACE_LOG1PF = 0; then
+ AC_CACHE_CHECK([whether log1pf works according to ISO C 99 with IEC 60559],
+ [gl_cv_func_log1pf_ieee],
+ [
+ save_LIBS="$LIBS"
+ LIBS="$LIBS $LOG1PF_LIBM"
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
+#ifndef __NO_MATH_INLINES
+# define __NO_MATH_INLINES 1 /* for glibc */
+#endif
+#include <math.h>
+]gl_FLOAT_MINUS_ZERO_CODE[
+]gl_FLOAT_SIGNBIT_CODE[
+static float dummy (float x) { return 0; }
+int main (int argc, char *argv[])
+{
+ float (*my_log1pf) (float) = argc ? log1pf : dummy;
+ /* This test fails on OpenBSD 4.9, AIX 7.1. */
+ float y = my_log1pf (minus_zerof);
+ if (!(y == 0.0f) || (signbitf (minus_zerof) && !signbitf (y)))
+ return 1;
+ return 0;
+}
+ ]])],
+ [gl_cv_func_log1pf_ieee=yes],
+ [gl_cv_func_log1pf_ieee=no],
+ [gl_cv_func_log1pf_ieee="guessing no"])
+ LIBS="$save_LIBS"
+ ])
+ case "$gl_cv_func_log1pf_ieee" in
+ *yes) ;;
+ *) REPLACE_LOG1PF=1 ;;
+ esac
+ fi
+ ])
else
HAVE_LOG1PF=0
fi
log1pf() function according to ISO C 99 with IEC 60559.
Files:
+m4/log1pf-ieee.m4
+m4/minus-zero.m4
+m4/signbit.m4
Depends-on:
log1pf
log1p-ieee [test $HAVE_LOG1PF = 0 || test $REPLACE_LOG1PF = 1]
configure.ac:
-AC_REQUIRE([gl_FUNC_LOG1PF])
+gl_FUNC_LOG1PF_IEEE
Makefile.am: