X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=tests%2Ftest-ceilf-ieee.c;h=3f3aaae32a09433b450d433b3acf89a3b8f2459d;hb=5191b3546cfb6c163228c23f214e325ddf60d46f;hp=475e4f416cd2ed70f91e68d360b7a0a90479f829;hpb=f10ca7e0a421ace0dd6124bd8f0ba8e7570ebec3;p=gnulib.git diff --git a/tests/test-ceilf-ieee.c b/tests/test-ceilf-ieee.c index 475e4f416..3f3aaae32 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-2013 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 @@ -18,7 +18,10 @@ #include +#include "isnanf-nolibm.h" #include "minus-zero.h" +#include "infinity.h" +#include "nan.h" #include "macros.h" /* If IEEE compliance was not requested, the ICC compiler inlines its @@ -37,9 +40,28 @@ 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)); + + /* [MX] shaded specification in POSIX. */ + + /* NaN. */ + ASSERT (isnanf (ceilf (NaNf ()))); + /* Infinity. */ + ASSERT (ceilf (Infinityf ()) == Infinityf ()); + ASSERT (ceilf (- Infinityf ()) == - Infinityf ()); return 0; }