diff options
author | Jakub Jelinek <jakub@redhat.com> | 2017-07-19 15:12:58 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2017-07-19 15:12:58 +0200 |
commit | 1eba0867060b1643d71d4185fbc23995248092bf (patch) | |
tree | b933cf0474996b72f099f09c134fd321c9590600 /libquadmath/math/floorq.c | |
parent | 564e405c138dc1891ca92462a585bf89444d7dd1 (diff) | |
download | gcc-1eba0867060b1643d71d4185fbc23995248092bf.zip gcc-1eba0867060b1643d71d4185fbc23995248092bf.tar.gz gcc-1eba0867060b1643d71d4185fbc23995248092bf.tar.bz2 |
re PR libquadmath/65757 (gfortran gives incorrect result for anint with real*16 argument)
PR libquadmath/65757
* quadmath-imp.h (math_opt_barrier, math_force_eval,
math_narrow_eval, math_check_force_underflow,
math_check_force_underflow_nonneg): Define.
* math/ceilq.c: Backport changes from upstream glibc
between 2012-11-01 and 2017-07-13.
* math/remquoq.c: Likewise.
* math/expq.c: Likewise.
* math/llroundq.c: Likewise.
* math/logq.c: Likewise.
* math/atanq.c: Likewise.
* math/nearbyintq.c: Likewise.
* math/scalblnq.c: Likewise.
* math/finiteq.c: Likewise.
* math/atanhq.c: Likewise.
* math/expm1q.c: Likewise.
* math/sinhq.c: Likewise.
* math/log10q.c: Likewise.
* math/rintq.c: Likewise.
* math/roundq.c: Likewise.
* math/fmaq.c: Likewise.
* math/erfq.c: Likewise.
* math/log2q.c: Likewise.
* math/lroundq.c: Likewise.
* math/j1q.c: Likewise.
* math/scalbnq.c: Likewise.
* math/truncq.c: Likewise.
* math/frexpq.c: Likewise.
* math/sincosq.c: Likewise.
* math/tanhq.c: Likewise.
* math/asinq.c: Likewise.
* math/coshq.c: Likewise.
* math/j0q.c: Likewise.
* math/asinhq.c: Likewise.
* math/floorq.c: Likewise.
* math/sinq_kernel.c: Likewise.
* math/powq.c: Likewise.
* math/hypotq.c: Likewise.
* math/sincos_table.c: Likewise.
* math/rem_pio2q.c: Likewise.
* math/nextafterq.c: Likewise.
* math/log1pq.c: Likewise.
* math/sincosq_kernel.c: Likewise.
* math/tanq.c: Likewise.
* math/acosq.c: Likewise.
* math/lrintq.c: Likewise.
* math/llrintq.c: Likewise.
From-SVN: r250343
Diffstat (limited to 'libquadmath/math/floorq.c')
-rw-r--r-- | libquadmath/math/floorq.c | 35 |
1 files changed, 14 insertions, 21 deletions
diff --git a/libquadmath/math/floorq.c b/libquadmath/math/floorq.c index 0d74f94..41b993f 100644 --- a/libquadmath/math/floorq.c +++ b/libquadmath/math/floorq.c @@ -15,8 +15,6 @@ #include "quadmath-imp.h" -static const __float128 huge = 1.0e4930Q; - __float128 floorq (__float128 x) { @@ -25,19 +23,16 @@ floorq (__float128 x) GET_FLT128_WORDS64(i0,i1,x); j0 = ((i0>>48)&0x7fff)-0x3fff; if(j0<48) { - if(j0<0) { /* raise inexact if x != 0 */ - if(huge+x>0.0) {/* return 0*sign(x) if |x|<1 */ - if(i0>=0) {i0=i1=0;} - else if(((i0&0x7fffffffffffffffLL)|i1)!=0) - { i0=0xbfff000000000000ULL;i1=0;} - } + if(j0<0) { + /* return 0*sign(x) if |x|<1 */ + if(i0>=0) {i0=i1=0;} + else if(((i0&0x7fffffffffffffffLL)|i1)!=0) + { i0=0xbfff000000000000ULL;i1=0;} } else { i = (0x0000ffffffffffffULL)>>j0; if(((i0&i)|i1)==0) return x; /* x is integral */ - if(huge+x>0.0) { /* raise inexact flag */ - if(i0<0) i0 += (0x0001000000000000LL)>>j0; - i0 &= (~i); i1=0; - } + if(i0<0) i0 += (0x0001000000000000LL)>>j0; + i0 &= (~i); i1=0; } } else if (j0>111) { if(j0==0x4000) return x+x; /* inf or NaN */ @@ -45,17 +40,15 @@ floorq (__float128 x) } else { i = -1ULL>>(j0-48); if((i1&i)==0) return x; /* x is integral */ - if(huge+x>0.0) { /* raise inexact flag */ - if(i0<0) { - if(j0==48) i0+=1; - else { - j = i1+(1LL<<(112-j0)); - if(j<i1) i0 +=1 ; /* got a carry */ - i1=j; - } + if(i0<0) { + if(j0==48) i0+=1; + else { + j = i1+(1LL<<(112-j0)); + if(j<i1) i0 +=1 ; /* got a carry */ + i1=j; } - i1 &= (~i); } + i1 &= (~i); } SET_FLT128_WORDS64(x,i0,i1); return x; |