view tests/test-ceilf1.c @ 13834:108bbfd6f03b

frexp, tests: work around ICC bug with -zero * m4/frexp.m4 (gl_FUNC_FREXP_WORKS): Compute -0.0 in a way that works with more compilers. * tests/minus-zero.h: New file. * modules/ceilf-tests (Files): Include it. * modules/ceill-tests (Files): Likewise. * modules/floorf-tests (Files): Likewise. * modules/floorl-tests (Files): Likewise. * modules/frexp-nolibm-tests (Files): Likewise. * modules/frexp-tests (Files): Likewise. * modules/frexpl-nolibm-tests (Files): Likewise. * modules/frexpl-tests (Files): Likewise. * modules/isnan-tests (Files): Likewise. * modules/isnand-nolibm-tests (Files): Likewise. * modules/isnand-tests (Files): Likewise. * modules/isnanf-nolibm-tests (Files): Likewise. * modules/isnanf-tests (Files): Likewise. * modules/isnanl-nolibm-tests (Files): Likewise. * modules/isnanl-tests (Files): Likewise. * modules/round-tests (Files): Likewise. * modules/roundf-tests (Files): Likewise. * modules/roundl-tests (Files): Likewise. * modules/ldexpl-tests (Files): Likewise. * modules/signbit-tests (Files): Likewise. * modules/snprintf-posix-tests (Files): Likewise. * modules/sprintf-posix-tests (Files): Likewise. * modules/strtod-tests (Files): Likewise. * modules/trunc-tests (Files): Likewise. * modules/truncf-tests (Files): Likewise. * modules/truncl-tests (Files): Likewise. * modules/vsnprintf-posix-tests (Files): Likewise. * modules/vsprintf-posix-tests (Files): Likewise. * modules/vasnprintf-posix-tests (Files): Likewise. * modules/vasprintf-posix-tests (Files): Likewise. * tests/test-ceilf1.c (main): Use it. * tests/test-ceill.c (main): Likewise. * tests/test-floorf1.c (main): Likewise. * tests/test-floorl.c (main): Likewise. * tests/test-frexp.c (main): Likewise. * tests/test-frexpl.c (main): Likewise. * tests/test-isnan.c (main): Likewise. * tests/test-isnand.h (main): Likewise. * tests/test-isnanf.h (main): Likewise. * tests/test-isnanl.h (main): Likewise. * tests/test-ldexpl.c (main): Likewise. * tests/test-round.c (main): Likewise. * tests/test-roundf.c (main): Likewise. * tests/test-roundl.c (main): Likewise. * tests/test-signbit.c (test_signbitf, test_signbitd) (test_signbitl): Likewise. * tests/test-snprintf-posix.h (test_function): Likewise. * tests/test-sprintf-posix.h (test_function): Likewise. * tests/test-strtod.c (main): Likewise. * tests/test-trunc1.c (main): Likewise. * tests/test-truncf1.c (main): Likewise. * tests/test-truncl.c (main): Likewise. Signed-off-by: Eric Blake <eblake@redhat.com>
author Eric Blake <eblake@redhat.com>
date Thu, 04 Nov 2010 12:29:27 -0600
parents c2cbabec01dd
children ed864b3ac8ec
line wrap: on
line source

/* Test of rounding towards positive infinity.
   Copyright (C) 2007-2010 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
   the Free Software Foundation; either version 3 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */

/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */

#include <config.h>

#include <math.h>

#include "signature.h"
SIGNATURE_CHECK (ceilf, float, (float));

#include "isnanf-nolibm.h"
#include "minus-zero.h"
#include "nan.h"
#include "macros.h"

int
main ()
{
  /* Zero.  */
  ASSERT (ceilf (0.0f) == 0.0f);
  ASSERT (ceilf (minus_zerof) == 0.0f);
  /* Positive numbers.  */
  ASSERT (ceilf (0.3f) == 1.0f);
  ASSERT (ceilf (0.7f) == 1.0f);
  ASSERT (ceilf (1.0f) == 1.0f);
  ASSERT (ceilf (1.001f) == 2.0f);
  ASSERT (ceilf (1.5f) == 2.0f);
  ASSERT (ceilf (1.999f) == 2.0f);
  ASSERT (ceilf (2.0f) == 2.0f);
  ASSERT (ceilf (65535.99f) == 65536.0f);
  ASSERT (ceilf (65536.0f) == 65536.0f);
  ASSERT (ceilf (2.341e31f) == 2.341e31f);
  /* Negative numbers.  */
  ASSERT (ceilf (-0.3f) == 0.0f);
  ASSERT (ceilf (-0.7f) == 0.0f);
  ASSERT (ceilf (-1.0f) == -1.0f);
  ASSERT (ceilf (-1.5f) == -1.0f);
  ASSERT (ceilf (-1.999f) == -1.0f);
  ASSERT (ceilf (-2.0f) == -2.0f);
  ASSERT (ceilf (-65535.99f) == -65535.0f);
  ASSERT (ceilf (-65536.0f) == -65536.0f);
  ASSERT (ceilf (-2.341e31f) == -2.341e31f);
  /* Infinite numbers.  */
  ASSERT (ceilf (1.0f / 0.0f) == 1.0f / 0.0f);
  ASSERT (ceilf (-1.0f / 0.0f) == -1.0f / 0.0f);
  /* NaNs.  */
  ASSERT (isnanf (ceilf (NaNf ())));

  return 0;
}