about summary refs log tree commit diff
path: root/sysdeps/ieee754/ldbl-96
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/ieee754/ldbl-96')
-rw-r--r--sysdeps/ieee754/ldbl-96/e_hypotl.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/sysdeps/ieee754/ldbl-96/e_hypotl.c b/sysdeps/ieee754/ldbl-96/e_hypotl.c
index 7895488848..d3152f91e5 100644
--- a/sysdeps/ieee754/ldbl-96/e_hypotl.c
+++ b/sysdeps/ieee754/ldbl-96/e_hypotl.c
@@ -89,6 +89,17 @@ long double __ieee754_hypotl(long double x, long double y)
 		b *= t1;
 		a *= t1;
 		k -= 16382;
+		GET_LDOUBLE_EXP (ea, a);
+		GET_LDOUBLE_EXP (eb, b);
+		if (eb > ea)
+		  {
+		    t1 = a;
+		    a = b;
+		    b = t1;
+		    j = ea;
+		    ea = eb;
+		    eb = j;
+		  }
 	    } else {		/* scale a and b by 2^9600 */
 		ea += 0x2580;	/* a *= 2^9600 */
 		eb += 0x2580;	/* b *= 2^9600 */