X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=tests%2Ftest-floor-ieee.c;h=d7671a1c095a17d2423819ed28f53f1419a4327b;hb=2949b7fd942e2dc3470dfcc42fd6b77e6b27418a;hp=0051d67f2507f2ddecedab870d08acef082cbf40;hpb=8938f22cb374f04f265ac3a9d2cefdc44524d6e2;p=gnulib.git diff --git a/tests/test-floor-ieee.c b/tests/test-floor-ieee.c index 0051d67f2..d7671a1c0 100644 --- a/tests/test-floor-ieee.c +++ b/tests/test-floor-ieee.c @@ -1,5 +1,5 @@ /* Test of rounding towards negative infinity. - 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 @@ -24,9 +24,20 @@ int main () { + /* 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 (floor (0.0))); ASSERT (!!signbit (floor (minus_zerod)) == !!signbit (minus_zerod)); + /* Positive numbers. */ + ASSERT (!signbit (floor (0.3))); + ASSERT (!signbit (floor (0.7))); + /* Negative numbers. */ + ASSERT (!!signbit (floor (-0.3)) == !!signbit (minus_zerod)); + ASSERT (!!signbit (floor (-0.7)) == !!signbit (minus_zerod)); return 0; }