about summary refs log tree commit diff
path: root/sysdeps/ieee754/ldbl-96/s_asinhl.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@gmail.com>2011-10-12 11:27:51 -0400
committerUlrich Drepper <drepper@gmail.com>2011-10-12 11:27:51 -0400
commit0ac5ae2335292908f39031b1ea9fe8edce433c0f (patch)
treef9d26c8abc0de39d18d4c13e70f6022cdc6b461f /sysdeps/ieee754/ldbl-96/s_asinhl.c
parenta843a204a3e8a0dd53584dad3668771abaec84ac (diff)
downloadglibc-0ac5ae2335292908f39031b1ea9fe8edce433c0f.tar.gz
glibc-0ac5ae2335292908f39031b1ea9fe8edce433c0f.tar.xz
glibc-0ac5ae2335292908f39031b1ea9fe8edce433c0f.zip
Optimize libm
libm is now somewhat integrated with gcc's -ffinite-math-only option
and lots of the wrapper functions have been optimized.
Diffstat (limited to 'sysdeps/ieee754/ldbl-96/s_asinhl.c')
-rw-r--r--sysdeps/ieee754/ldbl-96/s_asinhl.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/sysdeps/ieee754/ldbl-96/s_asinhl.c b/sysdeps/ieee754/ldbl-96/s_asinhl.c
index 6eb434c44b..9f37d48842 100644
--- a/sysdeps/ieee754/ldbl-96/s_asinhl.c
+++ b/sysdeps/ieee754/ldbl-96/s_asinhl.c
@@ -52,19 +52,21 @@ huge=  1.000000000000000000e+4900L;
 	int32_t hx,ix;
 	GET_LDOUBLE_EXP(hx,x);
 	ix = hx&0x7fff;
-	if(ix==0x7fff) return x+x;	/* x is inf or NaN */
-	if(ix< 0x3fde) {	/* |x|<2**-34 */
+	if(__builtin_expect(ix< 0x3fde, 0)) {	/* |x|<2**-34 */
 	    if(huge+x>one) return x;	/* return x inexact except 0 */
 	}
-	if(ix>0x4020) {		/* |x| > 2**34 */
+	if(__builtin_expect(ix>0x4020,0)) {		/* |x| > 2**34 */
+	    if(ix==0x7fff) return x+x;	/* x is inf or NaN */
 	    w = __ieee754_logl(fabsl(x))+ln2;
-	} else if (ix>0x4000) {	/* 2**34 > |x| > 2.0 */
-	    t = fabsl(x);
-	    w = __ieee754_logl(2.0*t+one/(__ieee754_sqrtl(x*x+one)+t));
-	} else {		/* 2.0 > |x| > 2**-28 */
-	    t = x*x;
-	    w =__log1pl(fabsl(x)+t/(one+__ieee754_sqrtl(one+t)));
+	} else {
+	    long double xa = fabsl(x);
+	    if (ix>0x4000) {	/* 2**34 > |x| > 2.0 */
+		w = __ieee754_logl(2.0*xa+one/(__ieee754_sqrtl(xa*xa+one)+xa));
+	    } else {		/* 2.0 > |x| > 2**-28 */
+		t = xa*xa;
+		w =__log1pl(xa+t/(one+__ieee754_sqrtl(one+t)));
+	    }
 	}
-	if(hx&0x8000) return -w; else return w;
+	return __copysignl(w, x);
 }
 weak_alias (__asinhl, asinhl)