Mercurial > hg > octave-lyh > gnulib-hg
changeset 9522:c5f570150caf
Fix bug with -0.0L in previous patch.
* lib/isnan.c (rpl_isnanl): Make robust to -0.0L and pad bits.
* tests/test-isnan.c (main): Also test on zeroes.
* tests/test-isnanf.c (main): Likewise.
* tests/test-isnanl.h (main): Likewise.
Signed-off-by: Eric Blake <ebb9@byu.net>
author | Eric Blake <ebb9@byu.net> |
---|---|
date | Tue, 11 Dec 2007 14:00:26 -0700 |
parents | 9e072640eeef |
children | 49f7561fc2d3 |
files | ChangeLog lib/isnan.c tests/test-isnan.c tests/test-isnanf.c tests/test-isnanl.h |
diffstat | 5 files changed, 15 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2007-12-11 Eric Blake <ebb9@byu.net> + Fix bug with -0.0L in previous patch. + * lib/isnan.c (rpl_isnanl): Make robust to -0.0L and pad bits. + * tests/test-isnan.c (main): Also test on zeroes. + * tests/test-isnanf.c (main): Likewise. + * tests/test-isnanl.h (main): Likewise. + Detect pseudo-denormals on x86 even when cross-compiling. * lib/isnan.c (rpl_isnanl) [!KNOWN_EXPBIT0_LOCATION && USE_LONG_DOUBLE && x86]: Add one more check to filter out
--- a/lib/isnan.c +++ b/lib/isnan.c @@ -146,8 +146,10 @@ memory_double m1; memory_double m2; + memset (&m1.value, 0, SIZE); + memset (&m2.value, 0, SIZE); m1.value = x; - m2.value = x + 0; + m2.value = x + (x ? 0.0L : -0.0L); if (memcmp (&m1.value, &m2.value, SIZE) != 0) return 1; # endif
--- a/tests/test-isnan.c +++ b/tests/test-isnan.c @@ -57,6 +57,8 @@ ASSERT (!isnan (-2.718)); ASSERT (!isnan (-2.718e30)); ASSERT (!isnan (-2.718e-30)); + ASSERT (!isnan (0.0)); + ASSERT (!isnan (-0.0)); /* Infinite values. */ ASSERT (!isnan (1.0 / 0.0)); ASSERT (!isnan (-1.0 / 0.0));
--- a/tests/test-isnanf.c +++ b/tests/test-isnanf.c @@ -57,6 +57,8 @@ ASSERT (!isnanf (-2.718f)); ASSERT (!isnanf (-2.718e30f)); ASSERT (!isnanf (-2.718e-30f)); + ASSERT (!isnanf (0.0f)); + ASSERT (!isnanf (-0.0f)); /* Infinite values. */ ASSERT (!isnanf (1.0f / 0.0f)); ASSERT (!isnanf (-1.0f / 0.0f));
--- a/tests/test-isnanl.h +++ b/tests/test-isnanl.h @@ -47,6 +47,8 @@ ASSERT (!isnanl (-2.718L)); ASSERT (!isnanl (-2.718e30L)); ASSERT (!isnanl (-2.718e-30L)); + ASSERT (!isnanl (0.0L)); + ASSERT (!isnanl (-0.0L)); /* Infinite values. */ ASSERT (!isnanl (1.0L / 0.0L)); ASSERT (!isnanl (-1.0L / 0.0L));