]> Savannah Git Hosting - gnulib.git/commitdiff
expl: Ensure replacement on Haiku.
authorBruno Haible <bruno@clisp.org>
Sun, 29 Oct 2017 10:16:56 +0000 (11:16 +0100)
committerBruno Haible <bruno@clisp.org>
Sun, 29 Oct 2017 20:27:50 +0000 (21:27 +0100)
* m4/expl.m4 (gl_FUNC_EXPL): Test whether an expl() return value is
zero.
* doc/posix-functions/expl.texi: Mention the Haiku problem.

ChangeLog
doc/posix-functions/expl.texi
m4/expl.m4

index bae2722a61d2a1dfc52d863d395b5b986d17d7a6..53745fc91a79e3aebd5915a22bd8a0893b4a7b0d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2017-10-29  Bruno Haible  <bruno@clisp.org>
+
+       expl: Ensure replacement on Haiku.
+       * m4/expl.m4 (gl_FUNC_EXPL): Test whether an expl() return value is
+       zero.
+       * doc/posix-functions/expl.texi: Mention the Haiku problem.
+
 2017-10-29  Bruno Haible  <bruno@clisp.org>
 
        math: Fix test failure on Haiku.
index 0a70d202fa75249d1a0f1e1520b0d55ff030d68c..92d7ed660647c46f7960ea13d9362155b4037a7b 100644 (file)
@@ -12,7 +12,10 @@ Portability problems fixed by Gnulib:
 This function is missing on some platforms:
 FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin, Interix 3.5, BeOS.
 @item
-This function returns NaN for small operands:
+This function returns 0.0 for all arguments on some platforms:
+Haiku 2017.
+@item
+This function returns NaN for small operands on some platforms:
 OpenBSD 5.4.
 @item
 This function is only defined as a macro with arguments on some platforms:
index 2eddf0a19e80680e45199786c224cdcd808b65ed..42db88b0520f8dac3771e710a2dbe9fb444c4a92 100644 (file)
@@ -1,4 +1,4 @@
-# expl.m4 serial 10
+# expl.m4 serial 11
 dnl Copyright (C) 2010-2017 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -54,31 +54,37 @@ AC_DEFUN([gl_FUNC_EXPL],
       EXPL_LIBM=-lm
     fi
   fi
-  dnl On OpenBSD5.4 the system's native expl() is buggy:
+  dnl On Haiku 2017 the system's native expl() is just a stub: it returns 0.0
+  dnl and prints "__expl not implemented" for all arguments.
+  dnl On OpenBSD 5.4 the system's native expl() is buggy:
   dnl it returns 'nan' for small values. Test for this anomaly.
   if test $gl_cv_func_expl_no_libm = yes \
      || test $gl_cv_func_expl_in_libm = yes; then
     AC_CACHE_CHECK([whether expl() breaks with small values],
-        [gl_cv_func_expl_buggy],
-        [
-          save_LIBS="$LIBS"
-          LIBS="$EXPL_LIBM"
-          AC_RUN_IFELSE(
-           [AC_LANG_PROGRAM(
-             [[#include <math.h>]],
-             [[return isnan(expl(-1.0))||
-                      isnan(expl(-0.8))||
-                      isnan(expl(-0.4)); ]])],
-             [gl_cv_func_expl_buggy=no], [gl_cv_func_expl_buggy=yes],
-             [case $host_os in
-                openbsd*) gl_cv_func_expl_buggy="guessing yes" ;;
-                          # Guess no on native Windows.
-                mingw*)   gl_cv_func_expl_buggy="guessing no" ;;
-                *)        gl_cv_func_expl_buggy="guessing no" ;;
-              esac
-             ])
-          LIBS="$save_LIBS"
-        ])
+      [gl_cv_func_expl_buggy],
+      [save_LIBS="$LIBS"
+       LIBS="$EXPL_LIBM"
+       AC_RUN_IFELSE(
+         [AC_LANG_PROGRAM(
+            [[#include <math.h>]],
+            [[volatile long double x1 = -1.0;
+              volatile long double x2 = -0.8;
+              volatile long double x3 = -0.4;
+              return expl(x1) == 0.0 || isnan(expl(x1))
+                     || isnan(expl(x2)) || isnan(expl(x3));
+            ]])
+         ],
+         [gl_cv_func_expl_buggy=no], [gl_cv_func_expl_buggy=yes],
+         [case $host_os in
+            haiku* | openbsd*)
+                      gl_cv_func_expl_buggy="guessing yes" ;;
+                      # Guess no on native Windows.
+            mingw*)   gl_cv_func_expl_buggy="guessing no" ;;
+            *)        gl_cv_func_expl_buggy="guessing no" ;;
+          esac
+         ])
+       LIBS="$save_LIBS"
+      ])
     case "$gl_cv_func_expl_buggy" in
       *yes)
         gl_cv_func_expl_in_libm=no