+
+dnl Test whether frexpf() works also on infinite numbers (this fails e.g. on
+dnl IRIX 6.5 and mingw) and on negative zero (this fails e.g. on mingw).
+AC_DEFUN([gl_FUNC_FREXPF_WORKS],
+[
+ AC_REQUIRE([AC_PROG_CC])
+ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+ AC_CACHE_CHECK([whether frexpf works], [gl_cv_func_frexpf_works],
+ [
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
+#include <float.h>
+#include <math.h>
+#include <string.h>
+/* HP cc on HP-UX 10.20 has a bug with the constant expression -0.0.
+ ICC 10.0 has a bug when optimizing the expression -zero.
+ The expression -FLT_MIN * FLT_MIN does not work when cross-compiling
+ to PowerPC on Mac OS X 10.5. */
+#if defined __hpux || defined __sgi || defined __ICC
+static float
+compute_minus_zero (void)
+{
+ return -FLT_MIN * FLT_MIN;
+}
+# define minus_zero compute_minus_zero ()
+#else
+float minus_zero = -0.0f;
+#endif
+int main()
+{
+ int result = 0;
+ volatile float x;
+ float zero = 0.0f;
+ /* Test on infinite numbers. */
+ x = 1.0f / zero;
+ {
+ int exp;
+ float y = frexpf (x, &exp);
+ if (y != x)
+ result |= 1;
+ }
+ /* Test on negative zero. */
+ x = minus_zero;
+ {
+ int exp;
+ float y = frexpf (x, &exp);
+ if (memcmp (&y, &x, sizeof x))
+ result |= 2;
+ }
+ return result;
+}]])],
+ [gl_cv_func_frexpf_works=yes],
+ [gl_cv_func_frexpf_works=no],
+ [case "$host_os" in
+ irix* | mingw*) gl_cv_func_frexpf_works="guessing no";;
+ *) gl_cv_func_frexpf_works="guessing yes";;
+ esac
+ ])
+ ])
+])