-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 According to Eric Blake on 3/30/2008 4:03 PM: | I'm wondering if it is a gcc -O2 bug? I'm not quite sure what | to do here, without access to a machine with those failures. Can you step | through the replacement function with a debugger?
Or maybe it's a signbit() bug? I noticed that test-signbit.c neglects to test 0.0 and -0.0. So I'm committing this. The test tries to be portable to platforms that lack -0.0 (although these days where IEEE format is prevalent, I'm not sure of any such machine). - -- Don't work too hard, make some time for fun as well! Eric Blake [EMAIL PROTECTED] -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.8 (Cygwin) Comment: Public key at home.comcast.net/~ericblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkfwF1kACgkQ84KuGfSFAYCLeACgysiXVBZLwmYwDuA1XJ0H6nZR ZgUAnj5OdKIc2SfTG34XMyMAcjsMvYrT =yyNg -----END PGP SIGNATURE-----
>From 089e636f5322e06f093f03d7da11a05dbc022e4f Mon Sep 17 00:00:00 2001 From: Eric Blake <[EMAIL PROTECTED]> Date: Sun, 30 Mar 2008 16:40:35 -0600 Subject: [PATCH] Test signbit behavior on zeros. * tests/test-signbit.c (test_signbitf): Add tests for zero. (test_signbitd, test_signbitl): Likewise. Signed-off-by: Eric Blake <[EMAIL PROTECTED]> --- ChangeLog | 4 ++++ tests/test-signbit.c | 20 +++++++++++++++++++- 2 files changed, 23 insertions(+), 1 deletions(-) diff --git a/ChangeLog b/ChangeLog index 982e035..932f2e8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2008-03-30 Eric Blake <[EMAIL PROTECTED]> + Test signbit behavior on zeros. + * tests/test-signbit.c (test_signbitf): Add tests for zero. + (test_signbitd, test_signbitl): Likewise. + More strtod touchups. * tests/test-strtod.c (main): Ignore tests for signbit on NaN, and sign of negative underflow, for now. Use .5, not .1. diff --git a/tests/test-signbit.c b/tests/test-signbit.c index 9cc65e3..3e01859 100644 --- a/tests/test-signbit.c +++ b/tests/test-signbit.c @@ -1,5 +1,5 @@ /* Test of signbit() substitute. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007, 2008 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -49,6 +49,12 @@ test_signbitf () ASSERT (signbit (-2.718f)); ASSERT (signbit (-2.718e30f)); ASSERT (signbit (-2.718e-30f)); + /* Zeros. */ + ASSERT (!signbit (0.0f)); + if (1.0f / -zerof < 0) + ASSERT (signbit (-0.0f)); + else + ASSERT (!signbit (-0.0f)); /* Infinite values. */ ASSERT (!signbit (1.0f / 0.0f)); ASSERT (signbit (-1.0f / 0.0f)); @@ -88,6 +94,12 @@ test_signbitd () ASSERT (signbit (-2.718)); ASSERT (signbit (-2.718e30)); ASSERT (signbit (-2.718e-30)); + /* Zeros. */ + ASSERT (!signbit (0.0)); + if (1.0 / -zerod < 0) + ASSERT (signbit (-0.0)); + else + ASSERT (!signbit (-0.0)); /* Infinite values. */ ASSERT (!signbit (1.0 / 0.0)); ASSERT (signbit (-1.0 / 0.0)); @@ -125,6 +137,12 @@ test_signbitl () ASSERT (signbit (-2.718L)); ASSERT (signbit (-2.718e30L)); ASSERT (signbit (-2.718e-30L)); + /* Zeros. */ + ASSERT (!signbit (0.0L)); + if (1.0L / -zerol < 0) + ASSERT (signbit (-0.0L)); + else + ASSERT (!signbit (-0.0L)); /* Infinite values. */ ASSERT (!signbit (1.0L / 0.0L)); ASSERT (signbit (-1.0L / 0.0L)); -- 1.5.4