summaryrefslogtreecommitdiff
path: root/m4/frexpl.m4
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2008-01-16 00:21:10 +0100
committerBruno Haible <bruno@clisp.org>2008-01-16 00:21:10 +0100
commit6ead6fb5989d246b06d28ae343cc1e8a319c1676 (patch)
treee2149a5b98a818699f39d4e568e66c725928fa87 /m4/frexpl.m4
parent19c94b20c15567bde81f5c8e93f5a462f1cec4e6 (diff)
downloadgnulib-6ead6fb5989d246b06d28ae343cc1e8a319c1676.tar.gz
Work around a MacOS X 10.5 bug in frexpl().
Diffstat (limited to 'm4/frexpl.m4')
-rw-r--r--m4/frexpl.m424
1 files changed, 20 insertions, 4 deletions
diff --git a/m4/frexpl.m4 b/m4/frexpl.m4
index 01cb1d9ed9..a4f2bd8cc6 100644
--- a/m4/frexpl.m4
+++ b/m4/frexpl.m4
@@ -1,5 +1,5 @@
-# frexpl.m4 serial 6
-dnl Copyright (C) 2007 Free Software Foundation, Inc.
+# frexpl.m4 serial 7
+dnl Copyright (C) 2007-2008 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.
@@ -96,8 +96,9 @@ AC_DEFUN([gl_FUNC_FREXPL_NO_LIBM],
])
dnl Test whether frexpl() works on finite numbers (this fails on
-dnl MacOS X 10.4/PowerPC, on AIX 5.1, and on BeOS) and also on infinite numbers
-dnl (this fails e.g. on IRIX 6.5 and mingw).
+dnl MacOS X 10.4/PowerPC, on AIX 5.1, and on BeOS), on denormalized numbers
+dnl (this fails on MacOS X 10.5/i386), and also on infinite numbers (this
+dnl fails e.g. on IRIX 6.5 and mingw).
AC_DEFUN([gl_FUNC_FREXPL_WORKS],
[
AC_REQUIRE([AC_PROG_CC])
@@ -144,6 +145,21 @@ int main()
return 1;
}
}
+ /* Test on denormalized numbers. */
+ {
+ int i;
+ for (i = 1, x = 1.0L; i >= LDBL_MIN_EXP; i--, x *= 0.5L)
+ ;
+ if (x > 0.0L)
+ {
+ int exp;
+ long double y = frexpl (x, &exp);
+ /* On machines with IEEE854 arithmetic: x = 1.68105e-4932,
+ exp = -16382, y = 0.5. On MacOS X 10.5: exp = -16384, y = 0.5. */
+ if (exp != LDBL_MIN_EXP - 1)
+ return 1;
+ }
+ }
/* Test on infinite numbers. */
x = 1.0L / 0.0L;
{