about summary refs log tree commit diff
path: root/sysdeps/ieee754/ldbl-128/s_nexttowardf.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2010-01-16 17:55:37 -0800
committerUlrich Drepper <drepper@redhat.com>2010-01-16 17:55:37 -0800
commit64f388285e11812f041d3aa8347f82efde4033c1 (patch)
tree5631149d6951216e5c41ea136ee26c5da06e08dc /sysdeps/ieee754/ldbl-128/s_nexttowardf.c
parent893549c5a06956d2559391a3ffdeb6ded53b65c0 (diff)
downloadglibc-64f388285e11812f041d3aa8347f82efde4033c1.tar.gz
glibc-64f388285e11812f041d3aa8347f82efde4033c1.tar.xz
glibc-64f388285e11812f041d3aa8347f82efde4033c1.zip
sysdeps/ieee754/ldbl-128/ fixes
Diffstat (limited to 'sysdeps/ieee754/ldbl-128/s_nexttowardf.c')
-rw-r--r--sysdeps/ieee754/ldbl-128/s_nexttowardf.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/sysdeps/ieee754/ldbl-128/s_nexttowardf.c b/sysdeps/ieee754/ldbl-128/s_nexttowardf.c
index 1a22e0102c..1f37d80e04 100644
--- a/sysdeps/ieee754/ldbl-128/s_nexttowardf.c
+++ b/sysdeps/ieee754/ldbl-128/s_nexttowardf.c
@@ -44,10 +44,12 @@ static char rcsid[] = "$NetBSD: $";
 	   return x+y;
 	if((long double) x==y) return y;	/* x=y, return y */
 	if(ix==0) {				/* x == 0 */
-	    float x2;
+	    float u;
 	    SET_FLOAT_WORD(x,(u_int32_t)((hy>>32)&0x80000000)|1);/* return +-minsub*/
-	    x2 = x*x;
-	    if(x2==x) return x2; else return x;	/* raise underflow flag */
+	    u = math_opt_barrier (x);
+	    u = u * u;
+	    math_force_eval (u);		/* raise underflow flag */
+	    return x;
 	}
 	if(hx>=0) {				/* x > 0 */
 	    if(hy<0||(ix>>23)>(iy>>48)-0x3f80
@@ -68,12 +70,9 @@ static char rcsid[] = "$NetBSD: $";
 	}
 	hy = hx&0x7f800000;
 	if(hy>=0x7f800000) return x+x;	/* overflow  */
-	if(hy<0x00800000) {		/* underflow */
-	    float x2 = x*x;
-	    if(x2!=x) {		/* raise underflow flag */
-	        SET_FLOAT_WORD(x2,hx);
-		return x2;
-	    }
+	if(hy<0x00800000) {
+	    float u = x*x;		/* underflow */
+	    math_force_eval (u);	/* raise underflow flag */
 	}
 	SET_FLOAT_WORD(x,hx);
 	return x;