Author: kargl
Date: Tue Dec 31 23:59:33 2013
New Revision: 260145
URL: http://svnweb.freebsd.org/changeset/base/260145

Log:
  * 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

Modified:
  head/lib/msun/man/cosh.3
  head/lib/msun/man/sinh.3
  head/lib/msun/man/tanh.3
  head/lib/msun/src/e_coshl.c
  head/lib/msun/src/e_sinhl.c
  head/lib/msun/src/s_tanhl.c

Modified: head/lib/msun/man/cosh.3
==============================================================================
--- head/lib/msun/man/cosh.3    Tue Dec 31 22:00:25 2013        (r260144)
+++ head/lib/msun/man/cosh.3    Tue Dec 31 23:59:33 2013        (r260145)
@@ -50,7 +50,7 @@
 The
 .Fn cosh ,
 .Fn coshf ,
-and the
+and
 .Fn coshl
 functions compute the hyperbolic cosine of
 .Fa x .

Modified: head/lib/msun/man/sinh.3
==============================================================================
--- head/lib/msun/man/sinh.3    Tue Dec 31 22:00:25 2013        (r260144)
+++ head/lib/msun/man/sinh.3    Tue Dec 31 23:59:33 2013        (r260145)
@@ -50,7 +50,7 @@
 The
 .Fn sinh ,
 .Fn sinhf ,
-and the
+and
 .Fn sinhl
 functions compute the hyperbolic sine of
 .Fa x .

Modified: head/lib/msun/man/tanh.3
==============================================================================
--- head/lib/msun/man/tanh.3    Tue Dec 31 22:00:25 2013        (r260144)
+++ head/lib/msun/man/tanh.3    Tue Dec 31 23:59:33 2013        (r260145)
@@ -50,7 +50,7 @@
 The
 .Fn tanh ,
 .Fn tanhf ,
-and the
+and
 .Fn tanhl
 functions compute the hyperbolic tangent of
 .Fa x .

Modified: head/lib/msun/src/e_coshl.c
==============================================================================
--- head/lib/msun/src/e_coshl.c Tue Dec 31 22:00:25 2013        (r260144)
+++ head/lib/msun/src/e_coshl.c Tue Dec 31 23:59:33 2013        (r260145)
@@ -78,7 +78,7 @@ C26 =  2.5022374732804632e-27;                /*  0x18
 #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 */
 

Modified: head/lib/msun/src/e_sinhl.c
==============================================================================
--- head/lib/msun/src/e_sinhl.c Tue Dec 31 22:00:25 2013        (r260144)
+++ head/lib/msun/src/e_sinhl.c Tue Dec 31 23:59:33 2013        (r260145)
@@ -77,7 +77,7 @@ S25 =  6.5067867911512749e-26;                /*  0x14
 #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 */
 

Modified: head/lib/msun/src/s_tanhl.c
==============================================================================
--- head/lib/msun/src/s_tanhl.c Tue Dec 31 22:00:25 2013        (r260144)
+++ head/lib/msun/src/s_tanhl.c Tue Dec 31 23:59:33 2013        (r260145)
@@ -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);
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to