{
  return 0;
}

int
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 ());
Esempio n. 2
0
   result when IEEE is not enforced.  To avoid spurious failure, we
   have to provide this dummy function in order to outsmart ICC's
   inlining, and call our ceilf through a function pointer.  */
static float
dummy (float f)
{
  return 0;
}

int
main (int argc, char **argv _GL_UNUSED)
{
  float (*my_ceilf) (float) = argc ? ceilf : dummy;

  /* Zero.  */
  ASSERT (my_ceilf (0.0f) == 0.0f);
  ASSERT (my_ceilf (minus_zerof) == 0.0f);
  /* Positive numbers.  */
  ASSERT (my_ceilf (0.3f) == 1.0f);
  ASSERT (my_ceilf (0.7f) == 1.0f);
  ASSERT (my_ceilf (1.0f) == 1.0f);
  ASSERT (my_ceilf (1.001f) == 2.0f);
  ASSERT (my_ceilf (1.5f) == 2.0f);
  ASSERT (my_ceilf (1.999f) == 2.0f);
  ASSERT (my_ceilf (2.0f) == 2.0f);
  ASSERT (my_ceilf (65535.99f) == 65536.0f);
  ASSERT (my_ceilf (65536.0f) == 65536.0f);
  ASSERT (my_ceilf (2.341e31f) == 2.341e31f);
  /* Negative numbers.  */
  ASSERT (my_ceilf (-0.3f) == 0.0f);
  ASSERT (my_ceilf (-0.7f) == 0.0f);