Mercurial > hg > CbC > CbC_gcc
diff libquadmath/math/nextafterq.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/nextafterq.c Sun Aug 21 07:07:55 2011 +0900 +++ b/libquadmath/math/nextafterq.c Fri Oct 27 22:46:09 2017 +0900 @@ -1,4 +1,4 @@ -/* s_nextafterl.c -- long double version of s_nextafter.c. +/* nextafterq.c -- __float128 version of s_nextafter.c. * Conversion to IEEE quad long double by Jakub Jelinek, jj@ultra.linux.cz. */ @@ -13,6 +13,7 @@ * ==================================================== */ +#include <errno.h> #include "quadmath-imp.h" __float128 @@ -54,9 +55,15 @@ } } hy = hx&0x7fff000000000000LL; - if(hy==0x7fff000000000000LL) return x+x;/* overflow */ + if(hy==0x7fff000000000000LL) { + __float128 u = x + x; /* overflow */ + math_force_eval (u); + errno = ERANGE; + } if(hy==0) { - /* here we should raise an underflow flag */ + __float128 u = x*x; /* underflow */ + math_force_eval (u); /* raise underflow flag */ + errno = ERANGE; } SET_FLT128_WORDS64(x,hx,lx); return x;