X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=tests%2Ftest-roundl-ieee.c;h=86bc3888406298159467c398b2452b8dc627f16c;hb=54c55a69f206e114d2bf294363314b226373f445;hp=ca4ac9ed7e5aa6ac8113f844e1ca09ecccdd9ad0;hpb=0f2428a839e2a11049eac5b8bf1d913be2a5dd56;p=gnulib.git diff --git a/tests/test-roundl-ieee.c b/tests/test-roundl-ieee.c index ca4ac9ed7..86bc38884 100644 --- a/tests/test-roundl-ieee.c +++ b/tests/test-roundl-ieee.c @@ -1,5 +1,5 @@ /* Test of rounding to nearest, breaking ties away from zero. - Copyright (C) 2010 Free Software Foundation, Inc. + Copyright (C) 2010-2011 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 @@ -30,9 +30,20 @@ main () BEGIN_LONG_DOUBLE_ROUNDING (); + /* See IEEE 754, section 6.3: + "the sign of the result of the round floating-point number to + integral value operation is the sign of the operand. These rules + shall apply even when operands or results are zero or infinite." */ + /* Zero. */ ASSERT (!signbit (roundl (0.0L))); ASSERT (!!signbit (roundl (minus_zerol)) == !!signbit (minus_zerol)); + /* Positive numbers. */ + ASSERT (!signbit (roundl (0.3L))); + ASSERT (!signbit (roundl (0.7L))); + /* Negative numbers. */ + ASSERT (!!signbit (roundl (-0.3L)) == !!signbit (minus_zerol)); + ASSERT (!!signbit (roundl (-0.7L)) == !!signbit (minus_zerol)); return 0; }