Mercurial > hg > CbC > CbC_gcc
diff libquadmath/math/scalblnq.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/scalblnq.c Sun Aug 21 07:07:55 2011 +0900 +++ b/libquadmath/math/scalblnq.c Fri Oct 27 22:46:09 2017 +0900 @@ -1,7 +1,7 @@ -/* s_scalblnl.c -- long double version of s_scalbn.c. +/* scalblnq.c -- __float128 version of s_scalbn.c. * Conversion to IEEE quad long double by Jakub Jelinek, jj@ultra.linux.cz. */ - + /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -13,6 +13,13 @@ * ==================================================== */ +/* + * scalblnq (_float128 x, long int n) + * scalblnq(x,n) returns x* 2**n computed by exponent + * manipulation rather than by actually performing an + * exponentiation or a multiplication. + */ + #include "quadmath-imp.h" static const __float128 @@ -34,10 +41,12 @@ k = ((hx>>48)&0x7fff) - 114; } if (k==0x7fff) return x+x; /* NaN or Inf */ + if (n< -50000) return tiny*copysignq(tiny,x); /*underflow*/ + if (n> 50000 || k+n > 0x7ffe) + return huge*copysignq(huge,x); /* overflow */ + /* Now k and n are bounded we know that k = k+n does not + overflow. */ k = k+n; - if (n> 50000 || k > 0x7ffe) - return huge*copysignq(huge,x); /* overflow */ - if (n< -50000) return tiny*copysignq(tiny,x); /*underflow*/ if (k > 0) /* normal result */ {SET_FLT128_MSW64(x,(hx&0x8000ffffffffffffULL)|(k<<48)); return x;} if (k <= -114)