diff options
author | kargl <kargl@FreeBSD.org> | 2013-12-31 23:59:33 +0000 |
---|---|---|
committer | kargl <kargl@FreeBSD.org> | 2013-12-31 23:59:33 +0000 |
commit | ffedbbec0256cfb43963d1d0e6175b9f87786eaa (patch) | |
tree | e32866594310ca9060f29cc0ffcd3025d413c84e /lib | |
parent | fbdc3a9423dfe09614c3098631f89bd50ebd3e6a (diff) | |
download | FreeBSD-src-ffedbbec0256cfb43963d1d0e6175b9f87786eaa.zip FreeBSD-src-ffedbbec0256cfb43963d1d0e6175b9f87786eaa.tar.gz |
* msun/man/cosh.3:
* msun/man/sinh.3:
* msun/man/tanh.3:
. Fix grammar.
* msun/src/e_coshl.c:
* msun/src/e_sinhl.c:
. Fix comment.
* msun/src/s_tanhl.c:
. Remove unused variables.
. Fix location/indentation of comments.
. Use comparison involving ints instead of long double.
. Re-order polynomial evaluation on ld128 for |x| < 0.25.
For now, retain the older order in an "#if 0 ... #else" block.
. Use int comparison to short-circuit the |x| < 1.5 condition.
Requested by: bde
Diffstat (limited to 'lib')
-rw-r--r-- | lib/msun/man/cosh.3 | 2 | ||||
-rw-r--r-- | lib/msun/man/sinh.3 | 2 | ||||
-rw-r--r-- | lib/msun/man/tanh.3 | 2 | ||||
-rw-r--r-- | lib/msun/src/e_coshl.c | 2 | ||||
-rw-r--r-- | lib/msun/src/e_sinhl.c | 2 | ||||
-rw-r--r-- | lib/msun/src/s_tanhl.c | 18 |
6 files changed, 18 insertions, 10 deletions
diff --git a/lib/msun/man/cosh.3 b/lib/msun/man/cosh.3 index e2d28b6..334b564 100644 --- a/lib/msun/man/cosh.3 +++ b/lib/msun/man/cosh.3 @@ -50,7 +50,7 @@ The .Fn cosh , .Fn coshf , -and the +and .Fn coshl functions compute the hyperbolic cosine of .Fa x . diff --git a/lib/msun/man/sinh.3 b/lib/msun/man/sinh.3 index cac7973..b34cc38 100644 --- a/lib/msun/man/sinh.3 +++ b/lib/msun/man/sinh.3 @@ -50,7 +50,7 @@ The .Fn sinh , .Fn sinhf , -and the +and .Fn sinhl functions compute the hyperbolic sine of .Fa x . diff --git a/lib/msun/man/tanh.3 b/lib/msun/man/tanh.3 index e1fc11a..ea2468f 100644 --- a/lib/msun/man/tanh.3 +++ b/lib/msun/man/tanh.3 @@ -50,7 +50,7 @@ The .Fn tanh , .Fn tanhf , -and the +and .Fn tanhl functions compute the hyperbolic tangent of .Fa x . diff --git a/lib/msun/src/e_coshl.c b/lib/msun/src/e_coshl.c index a4b0d84..0a21277 100644 --- a/lib/msun/src/e_coshl.c +++ b/lib/msun/src/e_coshl.c @@ -78,7 +78,7 @@ C26 = 2.5022374732804632e-27; /* 0x18c7ecf8b2c4a0.0p-141 */ #error "Unsupported long double format" #endif /* LDBL_MANT_DIG == 64 */ -/* log(2**16385 - 0.5) rounded towards up: */ +/* log(2**16385 - 0.5) rounded up: */ static const float o_threshold = 1.13572168e4; /* 0xb174de.0p-10 */ diff --git a/lib/msun/src/e_sinhl.c b/lib/msun/src/e_sinhl.c index 2187b13d..ce7e333 100644 --- a/lib/msun/src/e_sinhl.c +++ b/lib/msun/src/e_sinhl.c @@ -77,7 +77,7 @@ S25 = 6.5067867911512749e-26; /* 0x1423352626048a.0p-136 */ #error "Unsupported long double format" #endif /* LDBL_MANT_DIG == 64 */ -/* log(2**16385 - 0.5) rounded towards up: */ +/* log(2**16385 - 0.5) rounded up: */ static const float o_threshold = 1.13572168e4; /* 0xb174de.0p-10 */ diff --git a/lib/msun/src/s_tanhl.c b/lib/msun/src/s_tanhl.c index f42a70f..886158b 100644 --- a/lib/msun/src/s_tanhl.c +++ b/lib/msun/src/s_tanhl.c @@ -86,9 +86,8 @@ static inline long double divl(long double a, long double b, long double c, long double d, long double e, long double f) { - long double inv, r, w; + long double inv, r; float fr, fw; - uint32_t hx; _2sumF(a, c); b = b + c; @@ -128,12 +127,13 @@ tanhl(long double x) ENTERI(); - if (fabsl(x) < 40) { /* |x|<40 */ + /* |x| < 40 */ + if (ix < 0x4004 || fabsl(x) < 40) { /* |x|<40 */ if (__predict_false(ix<BIAS-(LDBL_MANT_DIG+1)/2)) { /* |x|<TINY */ /* tanh(+-0) = +0; tanh(tiny) = tiny(-+) with inexact: */ return (x == 0 ? x : (0x1p200 * x - x) * 0x1p-200); } - if (fabsl(x) < 0.25) { /* |x|<0.25 */ + if (ix<0x3ffd) { /* |x|<0.25 */ x2 = x*x; #if LDBL_MANT_DIG == 64 x4 = x2*x2; @@ -142,15 +142,23 @@ tanhl(long double x) T3*(x2*x) + x); #elif LDBL_MANT_DIG == 113 dx2 = x2; +#if 0 RETURNI(((((((((((((((T33*dx2 + T31)*dx2 + T29)*dx2 + T27)*dx2 + T25)*x2 + T23)*x2 + T21)*x2 + T19)*x2 + T17)*x2 + T15)*x2 + T13)*x2 + T11)*x2 + T9)*x2 + T7)*x2 + T5)* (x2*x*x2) + T3*(x2*x) + x); +#else + long double q = ((((((((((((((T33*dx2 + T31)*dx2 + T29)*dx2 + T27)*dx2 + + T25)*x2 + T23)*x2 + T21)*x2 + T19)*x2 + T17)*x2 + + T15)*x2 + T13)*x2 + T11)*x2 + T9)*x2 + T7)*x2 + T5)* + (x2*x*x2); + RETURNI(q + T3*(x2*x) + x); +#endif #endif } k_hexpl(2*fabsl(x), &hi, &lo); - if (fabsl(x) < 1.5) /* |x|<1.5 */ + if (ix<0x4001 && fabsl(x) < 1.5) /* |x|<1.5 */ z = divl(hi, lo, -0.5, hi, lo, 0.5); else z = one - one/(lo+0.5+hi); |