Mercurial > hg > CbC > CbC_gcc
diff libquadmath/math/roundq.c @ 111:04ced10e8804
gcc 7
author | kono |
---|---|
date | Fri, 27 Oct 2017 22:46:09 +0900 |
parents | 561a7518be6b |
children | 1830386684a0 |
line wrap: on
line diff
--- a/libquadmath/math/roundq.c Sun Aug 21 07:07:55 2011 +0900 +++ b/libquadmath/math/roundq.c Fri Oct 27 22:46:09 2017 +0900 @@ -1,5 +1,5 @@ -/* Round long double to integer away from zero. - Copyright (C) 1997, 1999 Free Software Foundation, Inc. +/* Round __float128 to integer away from zero. + Copyright (C) 1997-2017 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997 and Jakub Jelinek <jj@ultra.linux.cz>, 1999. @@ -21,9 +21,6 @@ #include "quadmath-imp.h" -static const __float128 huge = 1.0E4930Q; - - __float128 roundq (__float128 x) { @@ -32,17 +29,14 @@ GET_FLT128_WORDS64 (i0, i1, x); j0 = ((i0 >> 48) & 0x7fff) - 0x3fff; - if (j0 < 31) + if (j0 < 48) { if (j0 < 0) { - if (huge + x > 0.0) - { - i0 &= 0x8000000000000000ULL; - if (j0 == -1) - i0 |= 0x3fff000000000000LL; - i1 = 0; - } + i0 &= 0x8000000000000000ULL; + if (j0 == -1) + i0 |= 0x3fff000000000000LL; + i1 = 0; } else { @@ -50,13 +44,9 @@ if (((i0 & i) | i1) == 0) /* X is integral. */ return x; - if (huge + x > 0.0) - { - /* Raise inexact if x != 0. */ - i0 += 0x0000800000000000LL >> j0; - i0 &= ~i; - i1 = 0; - } + i0 += 0x0000800000000000LL >> j0; + i0 &= ~i; + i1 = 0; } } else if (j0 > 111) @@ -74,14 +64,10 @@ /* X is integral. */ return x; - if (huge + x > 0.0) - { - /* Raise inexact if x != 0. */ - uint64_t j = i1 + (1LL << (111 - j0)); - if (j < i1) - i0 += 1; - i1 = j; - } + uint64_t j = i1 + (1LL << (111 - j0)); + if (j < i1) + i0 += 1; + i1 = j; i1 &= ~i; }