Mercurial > hg > octave-lojdl > gnulib-hg
changeset 10418:1e251b3d489c
frexp: test for NetBSD failure on -0.0
* m4/frexp.m4 (gl_FUNC_FREXP_WORKS): Enhance test, since some, but
not all, bugs from NetBSD 3.0 have been fixed.
* doc/posix-functions/frexp.texi (frexp): Document bug.
Reported by Thomas Klausner.
Signed-off-by: Eric Blake <ebb9@byu.net>
author | Eric Blake <ebb9@byu.net> |
---|---|
date | Fri, 12 Sep 2008 06:52:41 -0600 |
parents | 16acbb4dea09 |
children | bbceefd03520 |
files | ChangeLog doc/posix-functions/frexp.texi m4/frexp.m4 |
diffstat | 3 files changed, 25 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2008-09-12 Eric Blake <ebb9@byu.net> + frexp: test for NetBSD failure on -0.0 + * m4/frexp.m4 (gl_FUNC_FREXP_WORKS): Enhance test, since some, but + not all, bugs from NetBSD 3.0 have been fixed. + * doc/posix-functions/frexp.texi (frexp): Document bug. + Reported by Thomas Klausner. + signbit: work around bug of HP-UX 10.20 cc with -0.0 literal * m4/signbit.m4 (gl_SIGNBIT_TEST_PROGRAM): Rewrite test to avoid literal -0.0.
--- a/doc/posix-functions/frexp.texi +++ b/doc/posix-functions/frexp.texi @@ -12,6 +12,9 @@ This function does not work on denormalized numbers on some platforms: NetBSD 3.0. @item +This function does not work on negative zero on some platforms: +NetBSD 4.99. +@item This function does not work on infinite numbers on some platforms: IRIX 6.5, mingw. @end itemize
--- a/m4/frexp.m4 +++ b/m4/frexp.m4 @@ -1,5 +1,5 @@ -# frexp.m4 serial 5 -dnl Copyright (C) 2007 Free Software Foundation, Inc. +# frexp.m4 serial 6 +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. @@ -88,7 +88,8 @@ ]) dnl Test whether frexp() works also on denormalized numbers (this fails e.g. on -dnl NetBSD 3.0) and on infinite numbers (this fails e.g. on IRIX 6.5 and mingw). +dnl NetBSD 3.0), on infinite numbers (this fails e.g. on IRIX 6.5 and mingw), +dnl and on negative zero (this fails e.g. on NetBSD 4.99). AC_DEFUN([gl_FUNC_FREXP_WORKS], [ AC_REQUIRE([AC_PROG_CC]) @@ -98,10 +99,14 @@ AC_TRY_RUN([ #include <float.h> #include <math.h> +#include <string.h> int main() { int i; volatile double x; +/* HP cc on HP-UX 10.20 has a bug with the constant expression -0.0. + So we use -zero instead. */ + double zero = 0.0; /* Test on denormalized numbers. */ for (i = 1, x = 1.0; i >= DBL_MIN_EXP; i--, x *= 0.5) ; @@ -122,6 +127,14 @@ if (y != x) return 1; } + /* Test on negative zero. */ + x = -zero; + { + int exp; + double y = frexp (x, &exp); + if (memcmp (&y, &x, sizeof x)) + return 1; + } return 0; }], [gl_cv_func_frexp_works=yes], [gl_cv_func_frexp_works=no], [case "$host_os" in