diff options
Diffstat (limited to 'sysdeps/ieee754/ldbl-96/e_hypotl.c')
-rw-r--r-- | sysdeps/ieee754/ldbl-96/e_hypotl.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/sysdeps/ieee754/ldbl-96/e_hypotl.c b/sysdeps/ieee754/ldbl-96/e_hypotl.c index ee3a07055b..f664e30c98 100644 --- a/sysdeps/ieee754/ldbl-96/e_hypotl.c +++ b/sysdeps/ieee754/ldbl-96/e_hypotl.c @@ -48,11 +48,12 @@ #include <math.h> #include <math_private.h> +#include <math-underflow.h> long double __ieee754_hypotl(long double x, long double y) { long double a,b,t1,t2,y1,y2,w; - u_int32_t j,k,ea,eb; + uint32_t j,k,ea,eb; GET_LDOUBLE_EXP(ea,x); ea &= 0x7fff; @@ -65,9 +66,11 @@ long double __ieee754_hypotl(long double x, long double y) k=0; if(__builtin_expect(ea > 0x5f3f,0)) { /* a>2**8000 */ if(ea == 0x7fff) { /* Inf or NaN */ - u_int32_t exp __attribute__ ((unused)); - u_int32_t high,low; + uint32_t exp __attribute__ ((unused)); + uint32_t high,low; w = a+b; /* for sNaN */ + if (issignaling (a) || issignaling (b)) + return w; GET_LDOUBLE_WORDS(exp,high,low,a); if(((high&0x7fffffff)|low)==0) w = a; GET_LDOUBLE_WORDS(exp,high,low,b); @@ -81,8 +84,8 @@ long double __ieee754_hypotl(long double x, long double y) } if(__builtin_expect(eb < 0x20bf, 0)) { /* b < 2**-8000 */ if(eb == 0) { /* subnormal b or 0 */ - u_int32_t exp __attribute__ ((unused)); - u_int32_t high,low; + uint32_t exp __attribute__ ((unused)); + uint32_t high,low; GET_LDOUBLE_WORDS(exp,high,low,b); if((high|low)==0) return a; SET_LDOUBLE_WORDS(t1, 0x7ffd, 0x80000000, 0); /* t1=2^16382 */ @@ -111,13 +114,13 @@ long double __ieee754_hypotl(long double x, long double y) /* medium size a and b */ w = a-b; if (w>b) { - u_int32_t high; + uint32_t high; GET_LDOUBLE_MSW(high,a); SET_LDOUBLE_WORDS(t1,ea,high,0); t2 = a-t1; - w = __ieee754_sqrtl(t1*t1-(b*(-b)-t2*(a+t1))); + w = sqrtl(t1*t1-(b*(-b)-t2*(a+t1))); } else { - u_int32_t high; + uint32_t high; GET_LDOUBLE_MSW(high,b); a = a+a; SET_LDOUBLE_WORDS(y1,eb,high,0); @@ -125,10 +128,10 @@ long double __ieee754_hypotl(long double x, long double y) GET_LDOUBLE_MSW(high,a); SET_LDOUBLE_WORDS(t1,ea+1,high,0); t2 = a - t1; - w = __ieee754_sqrtl(t1*y1-(w*(-w)-(t1*y2+t2*b))); + w = sqrtl(t1*y1-(w*(-w)-(t1*y2+t2*b))); } if(k!=0) { - u_int32_t exp; + uint32_t exp; t1 = 1.0; GET_LDOUBLE_EXP(exp,t1); SET_LDOUBLE_EXP(t1,exp+k); |