X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=tests%2Ftest-ceilf1.c;h=8931a62afc0834f24015b862266c559aaca3542a;hb=5e40996ccdb9e2f9398ecd7eccdf477b8e770461;hp=485b16f4d7a2e03f25ed8f99ff82657c478a954c;hpb=fcb8ef08b9e77cd525d0de9f518eb49346498104;p=gnulib.git diff --git a/tests/test-ceilf1.c b/tests/test-ceilf1.c index 485b16f4d..8931a62af 100644 --- a/tests/test-ceilf1.c +++ b/tests/test-ceilf1.c @@ -1,5 +1,5 @@ /* Test of rounding towards positive infinity. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007-2008 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 @@ -23,35 +23,31 @@ #include #include +#include "isnanf-nolibm.h" +#include "nan.h" + #define ASSERT(expr) \ do \ { \ if (!(expr)) \ { \ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + fflush (stderr); \ abort (); \ } \ } \ while (0) -/* The Compaq (ex-DEC) C 6.4 compiler chokes on the expression 0.0 / 0.0. */ -#ifdef __DECC -static float -NaN () -{ - static float zero = 0.0f; - return zero / zero; -} -#else -# define NaN() (0.0f / 0.0f) -#endif +/* HP cc on HP-UX 10.20 has a bug with the constant expression -0.0f. + So we use -zero instead. */ +float zero = 0.0f; int main () { /* Zero. */ ASSERT (ceilf (0.0f) == 0.0f); - ASSERT (ceilf (-0.0f) == 0.0f); + ASSERT (ceilf (-zero) == 0.0f); /* Positive numbers. */ ASSERT (ceilf (0.3f) == 1.0f); ASSERT (ceilf (0.7f) == 1.0f); @@ -77,7 +73,7 @@ main () ASSERT (ceilf (1.0f / 0.0f) == 1.0f / 0.0f); ASSERT (ceilf (-1.0f / 0.0f) == -1.0f / 0.0f); /* NaNs. */ - ASSERT (isnan (ceilf (NaN ()))); + ASSERT (isnanf (ceilf (NaNf ()))); return 0; }