Hello, On Wed, Aug 12, 2015 at 04:28:24PM -0700, Paul Eggert wrote:
Thanks, looks good, though I'd change "(ceill(d)==1)" to "(ceill (d) == 1)" as per the usual GNU style.
fix attached.
It's big enough that we'll need paperwork from you for Gnulib.
Copyright assignments for gnulib are now in place. Thanks, - assaf
>From a2abacb8133f07c9aa629db03a8e9008d0d15931 Mon Sep 17 00:00:00 2001 From: Assaf Gordon <assafgor...@gmail.com> Date: Tue, 8 Sep 2015 19:43:32 -0400 Subject: [PATCH] ceill: detect buggy OpenBSD implementation * m4/ceill.m4: detect buggy openBSD implementation which returns zero for small values. discussed here: http://lists.gnu.org/archive/html/bug-gnulib/2015-08/msg00010.html --- m4/ceill.m4 | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/m4/ceill.m4 b/m4/ceill.m4 index 51c0c56..756d29a 100644 --- a/m4/ceill.m4 +++ b/m4/ceill.m4 @@ -69,6 +69,31 @@ int main (int argc, char *argv[]) else HAVE_DECL_CEILL=0 fi + dnl On OpenBSD5.6 the system's native ceill() is buggy: + dnl it returns '0' for small values. Test for this anomaly. + if test $REPLACE_CEILL = 0 ; then + AC_CACHE_CHECK([whether ceill() breaks with small values], + [gl_cv_func_ceill_buggy], + [ + save_LIBS="$LIBS" + LIBS="$CEILL_LIBM" + AC_RUN_IFELSE( + [AC_LANG_PROGRAM( + [[#include <math.h> +long double d = 0.3L;]], + [[return (!(ceill (d) == 1)); ]])], + [gl_cv_func_ceill_buggy=no], [gl_cv_func_ceill_buggy=yes], + [case $host_os in + openbsd*) gl_cv_func_ceill_buggy="guessing yes";; + *) gl_cv_func_ceill_buggy="guessing no";; + esac]) + LIBS="$save_LIBS" + ]) + case "$gl_cv_func_ceill_buggy" in + *yes) + REPLACE_CEILL=1 ;; + esac + fi if test $HAVE_DECL_CEILL = 0 || test $REPLACE_CEILL = 1; then dnl Find libraries needed to link lib/ceill.c. if test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 1; then -- 1.9.1