X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=tests%2Ftest-floor2.c;h=674daf00c3273a0140160115b0074fad359c92ab;hb=d6e564567eb4ab3033d8e08c8467e3d1a3f51c0d;hp=1aca8ab5f35aa4cd451688b62f0295658ada897e;hpb=de3f6e3f012bbaa9e536592318d5925a12bb2288;p=gnulib.git diff --git a/tests/test-floor2.c b/tests/test-floor2.c index 1aca8ab5f..674daf00c 100644 --- a/tests/test-floor2.c +++ b/tests/test-floor2.c @@ -1,5 +1,5 @@ /* Test of rounding towards negative infinity. - Copyright (C) 2007-2010 Free Software Foundation, Inc. + Copyright (C) 2007-2011 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 @@ -63,8 +63,12 @@ floor_reference (DOUBLE x) if (z > L_(0.0)) { + /* For 0 < x < 1, return +0.0 even if the current rounding mode is + FE_DOWNWARD. */ + if (z < L_(1.0)) + z = L_(0.0); /* Avoid rounding errors for values near 2^k, where k >= MANT_DIG-1. */ - if (z < TWO_MANT_DIG) + else if (z < TWO_MANT_DIG) { /* Round to the next integer (nearest or up or down, doesn't matter). */ z += TWO_MANT_DIG; @@ -140,7 +144,7 @@ check (double x) int main () { -#if UINT64_MAX +#ifdef UINT64_MAX unsigned int highbits; unsigned int lowbits; int error = 0;