Mercurial > hg > octave-nkf > gnulib-hg
changeset 9840:bb59cc79cbdb
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 <ebb9@byu.net>
author | Eric Blake <ebb9@byu.net> |
---|---|
date | Sun, 30 Mar 2008 16:40:35 -0600 |
parents | 3dc6b2551b2e |
children | a95dd6984607 |
files | ChangeLog tests/test-signbit.c |
diffstat | 2 files changed, 23 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2008-03-30 Eric Blake <ebb9@byu.net> + 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.
--- 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 @@ 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 @@ 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 @@ 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));