about summary refs log tree commit diff
path: root/sysdeps/ieee754/ldbl-96/s_asinhl.c
diff options
context:
space:
mode:
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)