+
+dnl Test whether logb() works.
+dnl On glibc 2.11/ppc, glibc 2.7/sparc, glibc 2.7/hppa, Solaris 10/SPARC,
+dnl Cygwin 1.5.x, the return value for subnormal (denormalized) arguments is
+dnl too large.
+AC_DEFUN([gl_FUNC_LOGB_WORKS],
+[
+ AC_REQUIRE([AC_PROG_CC])
+ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+ AC_CACHE_CHECK([whether logb works], [gl_cv_func_logb_works],
+ [
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
+#include <float.h>
+#include <math.h>
+extern
+#ifdef __cplusplus
+"C"
+#endif
+double logb (double);
+volatile double x;
+int main ()
+{
+ int i;
+ for (i = 1, x = 1.0; i >= DBL_MIN_EXP; i--, x *= 0.5)
+ ;
+ /* Here i = DBL_MIN_EXP - 1. Either x = 2^(i-1) is subnormal or x = 0.0. */
+ if (x > 0.0 && !(logb (x) == (double)(i - 1)))
+ return 1;
+ return 0;
+}
+]])],
+ [gl_cv_func_logb_works=yes],
+ [gl_cv_func_logb_works=no],
+ [case "$host_os" in
+ *gnu* | solaris* | cygwin*) gl_cv_func_logb_works="guessing no";;
+ *) gl_cv_func_logb_works="guessing yes";;
+ esac
+ ])
+ ])
+])