X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=tests%2Ftest-trunc1.c;h=65b027af7741e8aab05a74043cd327a302abdca2;hb=f5d7314bdeb3d2022ed572f48feba6546baf5f5b;hp=6b283636e4c4207c9054ea796566343479ef3b1f;hpb=06945b7c073c0872ec2049c0e0b94f789bf8d77e;p=gnulib.git diff --git a/tests/test-trunc1.c b/tests/test-trunc1.c index 6b283636e..65b027af7 100644 --- a/tests/test-trunc1.c +++ b/tests/test-trunc1.c @@ -1,5 +1,5 @@ /* Test of rounding towards zero. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + 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 @@ -20,28 +20,23 @@ #include -#include -#include +#include "signature.h" +SIGNATURE_CHECK (trunc, double, (double)); -#include "isnand.h" +#include "isnand-nolibm.h" +#include "nan.h" +#include "macros.h" -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - abort (); \ - } \ - } \ - while (0) +/* HP cc on HP-UX 10.20 has a bug with the constant expression -0.0. + So we use -zero instead. */ +double zero = 0.0; int main () { /* Zero. */ ASSERT (trunc (0.0) == 0.0); - ASSERT (trunc (-0.0) == 0.0); + ASSERT (trunc (-zero) == 0.0); /* Positive numbers. */ ASSERT (trunc (0.3) == 0.0); ASSERT (trunc (0.7) == 0.0); @@ -66,7 +61,7 @@ main () ASSERT (trunc (1.0 / 0.0) == 1.0 / 0.0); ASSERT (trunc (-1.0 / 0.0) == -1.0 / 0.0); /* NaNs. */ - ASSERT (isnand (trunc (NAN))); + ASSERT (isnand (trunc (NaNd ()))); return 0; }