X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=tests%2Ftest-floorf-ieee.c;h=071a130de7ec757a8c86048710809f9d4bfcbffa;hb=12597d104c0c1d6368eed9a9f1ebacd03f99542e;hp=da13848738f38e4dc3d8f428ea21209a40e33d63;hpb=1d7de2b4c343cfb0eb4d1171acf0877630e32151;p=gnulib.git diff --git a/tests/test-floorf-ieee.c b/tests/test-floorf-ieee.c index da1384873..071a130de 100644 --- a/tests/test-floorf-ieee.c +++ b/tests/test-floorf-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 @@ -37,9 +37,20 @@ main (int argc, char **argv _GL_UNUSED) { float (*my_floorf) (float) = argc ? floorf : dummy; + /* 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 (my_floorf (0.0f))); ASSERT (!!signbit (my_floorf (minus_zerof)) == !!signbit (minus_zerof)); + /* Positive numbers. */ + ASSERT (!signbit (my_floorf (0.3f))); + ASSERT (!signbit (my_floorf (0.7f))); + /* Negative numbers. */ + ASSERT (!!signbit (my_floorf (-0.3f)) == !!signbit (minus_zerof)); + ASSERT (!!signbit (my_floorf (-0.7f)) == !!signbit (minus_zerof)); return 0; }