Mercurial > hg > octave-lyh > gnulib-hg
changeset 13835:ed864b3ac8ec
ceil, floor, round, trunc: enhance tests of -0
* tests/test-ceilf1.c (main): Ensure correct sign of result.
* tests/test-ceill.c (main): Likewise.
* tests/test-floorf1.c (main): Likewise.
* tests/test-floorl.c (main): Likewise.
* tests/test-round1.c (main): Likewise.
* tests/test-roundf1.c (main): Likewise.
* tests/test-roundl.c (main): Likewise.
* tests/test-trunc1.c (main): Likewise.
* tests/test-truncf1.c (main): Likewise.
* tests/test-truncl.c (main): Likewise.
Signed-off-by: Eric Blake <eblake@redhat.com>
author | Eric Blake <eblake@redhat.com> |
---|---|
date | Thu, 04 Nov 2010 15:53:52 -0600 |
parents | 108bbfd6f03b |
children | 2ba13be8e841 |
files | ChangeLog modules/ceilf-tests tests/test-ceilf1.c tests/test-ceill.c tests/test-floorf1.c tests/test-floorl.c tests/test-round1.c tests/test-roundf1.c tests/test-roundl.c tests/test-trunc1.c tests/test-truncf1.c tests/test-truncl.c |
diffstat | 12 files changed, 35 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2010-11-04 Eric Blake <eblake@redhat.com> + + ceil, floor, round, trunc: enhance tests of -0 + * tests/test-ceilf1.c (main): Ensure correct sign of result. + * tests/test-ceill.c (main): Likewise. + * tests/test-floorf1.c (main): Likewise. + * tests/test-floorl.c (main): Likewise. + * tests/test-round1.c (main): Likewise. + * tests/test-roundf1.c (main): Likewise. + * tests/test-roundl.c (main): Likewise. + * tests/test-trunc1.c (main): Likewise. + * tests/test-truncf1.c (main): Likewise. + * tests/test-truncl.c (main): Likewise. + 2010-11-04 Eric Blake <eblake@redhat.com> frexp, tests: work around ICC bug with -zero
--- a/modules/ceilf-tests +++ b/modules/ceilf-tests @@ -9,6 +9,7 @@ Depends-on: float isnanf-nolibm +signbit stdbool stdint
--- a/tests/test-ceilf1.c +++ b/tests/test-ceilf1.c @@ -33,7 +33,9 @@ { /* Zero. */ ASSERT (ceilf (0.0f) == 0.0f); + ASSERT (!signbit (ceilf (0.0f))); ASSERT (ceilf (minus_zerof) == 0.0f); + ASSERT (!!signbit (minus_zerof) == !!signbit (ceilf (minus_zerof))); /* Positive numbers. */ ASSERT (ceilf (0.3f) == 1.0f); ASSERT (ceilf (0.7f) == 1.0f);
--- a/tests/test-ceill.c +++ b/tests/test-ceill.c @@ -40,7 +40,9 @@ /* Zero. */ ASSERT (ceill (0.0L) == 0.0L); + ASSERT (!signbit (ceill (0.0L))); ASSERT (ceill (minus_zerol) == 0.0L); + ASSERT (!!signbit (minus_zerol) == !!signbit (ceill (minus_zerol))); /* Positive numbers. */ ASSERT (ceill (0.3L) == 1.0L); ASSERT (ceill (0.7L) == 1.0L);
--- a/tests/test-floorf1.c +++ b/tests/test-floorf1.c @@ -33,7 +33,9 @@ { /* Zero. */ ASSERT (floorf (0.0f) == 0.0f); + ASSERT (!signbit (floorf (0.0f))); ASSERT (floorf (minus_zerof) == 0.0f); + ASSERT (!!signbit (minus_zerof) == !!signbit (floorf (minus_zerof))); /* Positive numbers. */ ASSERT (floorf (0.3f) == 0.0f); ASSERT (floorf (0.7f) == 0.0f);
--- a/tests/test-floorl.c +++ b/tests/test-floorl.c @@ -40,7 +40,9 @@ /* Zero. */ ASSERT (floorl (0.0L) == 0.0L); + ASSERT (!signbit (floorl (0.0L))); ASSERT (floorl (minus_zerol) == 0.0L); + ASSERT (!!signbit (minus_zerol) == !!signbit (floorl (minus_zerol))); /* Positive numbers. */ ASSERT (floorl (0.3L) == 0.0L); ASSERT (floorl (0.7L) == 0.0L);
--- a/tests/test-round1.c +++ b/tests/test-round1.c @@ -35,7 +35,9 @@ { /* Zero. */ ASSERT (round (0.0) == 0.0); + ASSERT (!signbit (round (0.0))); ASSERT (round (minus_zerod) == 0.0); + ASSERT (!!signbit (minus_zerod) == !!signbit (round (minus_zerod))); /* Positive numbers. */ ASSERT (round (0.3) == 0.0); ASSERT (round (0.5) == 1.0);
--- a/tests/test-roundf1.c +++ b/tests/test-roundf1.c @@ -35,7 +35,9 @@ { /* Zero. */ ASSERT (roundf (0.0f) == 0.0f); + ASSERT (!signbit (roundf (0.0f))); ASSERT (roundf (minus_zerof) == 0.0f); + ASSERT (!!signbit (minus_zerof) == !!signbit (roundf (minus_zerof))); /* Positive numbers. */ ASSERT (roundf (0.3f) == 0.0f); ASSERT (roundf (0.5f) == 1.0f);
--- a/tests/test-roundl.c +++ b/tests/test-roundl.c @@ -42,7 +42,9 @@ /* Zero. */ ASSERT (roundl (0.0L) == 0.0L); + ASSERT (!signbit (roundl (0.0L))); ASSERT (roundl (minus_zerol) == 0.0L); + ASSERT (!!signbit (minus_zerol) == !!signbit (roundl (minus_zerol))); /* Positive numbers. */ ASSERT (roundl (0.3L) == 0.0L); ASSERT (roundl (0.5L) == 1.0L);
--- a/tests/test-trunc1.c +++ b/tests/test-trunc1.c @@ -33,7 +33,9 @@ { /* Zero. */ ASSERT (trunc (0.0) == 0.0); + ASSERT (!signbit (trunc (0.0))); ASSERT (trunc (minus_zerod) == 0.0); + ASSERT (!!signbit (minus_zerod) == !!signbit (trunc (minus_zerod))); /* Positive numbers. */ ASSERT (trunc (0.3) == 0.0); ASSERT (trunc (0.7) == 0.0);
--- a/tests/test-truncf1.c +++ b/tests/test-truncf1.c @@ -33,7 +33,9 @@ { /* Zero. */ ASSERT (truncf (0.0f) == 0.0f); + ASSERT (!signbit (truncf (0.0f))); ASSERT (truncf (minus_zerof) == 0.0f); + ASSERT (!!signbit (minus_zerof) == !!signbit (truncf (minus_zerof))); /* Positive numbers. */ ASSERT (truncf (0.3f) == 0.0f); ASSERT (truncf (0.7f) == 0.0f);
--- a/tests/test-truncl.c +++ b/tests/test-truncl.c @@ -40,7 +40,9 @@ /* Zero. */ ASSERT (truncl (0.0L) == 0.0L); + ASSERT (!signbit (truncl (0.0L))); ASSERT (truncl (minus_zerol) == 0.0L); + ASSERT (!!signbit (minus_zerol) == !!signbit (truncl (minus_zerol))); /* Positive numbers. */ ASSERT (truncl (0.3L) == 0.0L); ASSERT (truncl (0.7L) == 0.0L);