diff options
author | das <das@FreeBSD.org> | 2011-10-21 06:28:47 +0000 |
---|---|---|
committer | das <das@FreeBSD.org> | 2011-10-21 06:28:47 +0000 |
commit | f66ae96060daab6b90cb9d24fa049e4c17f3b80f (patch) | |
tree | ead8ba08a5f00879a3fa0436cc24c942c1a6477a /lib/msun/src/e_cosh.c | |
parent | 791a3ff0bf568d12e5a870ebbcfb9877804bac46 (diff) | |
download | FreeBSD-src-f66ae96060daab6b90cb9d24fa049e4c17f3b80f.zip FreeBSD-src-f66ae96060daab6b90cb9d24fa049e4c17f3b80f.tar.gz |
Use __ldexp_exp() to simplify things and improve accuracy for x near
the overflow threshold.
Diffstat (limited to 'lib/msun/src/e_cosh.c')
-rw-r--r-- | lib/msun/src/e_cosh.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/lib/msun/src/e_cosh.c b/lib/msun/src/e_cosh.c index 11e6590..a363695 100644 --- a/lib/msun/src/e_cosh.c +++ b/lib/msun/src/e_cosh.c @@ -45,7 +45,6 @@ __ieee754_cosh(double x) { double t,w; int32_t ix; - u_int32_t lx; /* High word of |x|. */ GET_HIGH_WORD(ix,x); @@ -72,13 +71,8 @@ __ieee754_cosh(double x) if (ix < 0x40862E42) return half*__ieee754_exp(fabs(x)); /* |x| in [log(maxdouble), overflowthresold] */ - GET_LOW_WORD(lx,x); - if (ix<0x408633CE || - ((ix==0x408633ce)&&(lx<=(u_int32_t)0x8fb9f87d))) { - w = __ieee754_exp(half*fabs(x)); - t = half*w; - return t*w; - } + if (ix<=0x408633CE) + return __ldexp_exp(fabs(x), -1); /* |x| > overflowthresold, cosh(x) overflow */ return huge*huge; |