X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=tests%2Ftest-ceilf-ieee.c;h=c071265795c8804504a867f309cc88a88d67a5ae;hb=60e3ab133c3ffe0bae411a44829498faf8816b34;hp=475e4f416cd2ed70f91e68d360b7a0a90479f829;hpb=f10ca7e0a421ace0dd6124bd8f0ba8e7570ebec3;p=gnulib.git diff --git a/tests/test-ceilf-ieee.c b/tests/test-ceilf-ieee.c index 475e4f416..c07126579 100644 --- a/tests/test-ceilf-ieee.c +++ b/tests/test-ceilf-ieee.c @@ -1,5 +1,5 @@ /* Test of rounding towards positive 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_ceilf) (float) = argc ? ceilf : 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_ceilf (0.0f))); ASSERT (!!signbit (my_ceilf (minus_zerof)) == !!signbit (minus_zerof)); + /* Positive numbers. */ + ASSERT (!signbit (my_ceilf (0.3f))); + ASSERT (!signbit (my_ceilf (0.7f))); + /* Negative numbers. */ + ASSERT (!!signbit (my_ceilf (-0.3f)) == !!signbit (minus_zerof)); + ASSERT (!!signbit (my_ceilf (-0.7f)) == !!signbit (minus_zerof)); return 0; }