about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/math/hypot.c9
-rw-r--r--src/math/hypotf.c6
2 files changed, 4 insertions, 11 deletions
diff --git a/src/math/hypot.c b/src/math/hypot.c
index ba4c7575..9a4cbdb3 100644
--- a/src/math/hypot.c
+++ b/src/math/hypot.c
@@ -117,12 +117,7 @@ double hypot(double x, double y)
 		t2 = a - t1;
 		w  = sqrt(t1*y1-(w*(-w)-(t1*y2+t2*b)));
 	}
-	if (k != 0) {
-		uint32_t high;
-		t1 = 1.0;
-		GET_HIGH_WORD(high, t1);
-		SET_HIGH_WORD(t1, high+(k<<20));
-		return t1*w;
-	}
+	if (k)
+		w = scalbn(w, k);
 	return w;
 }
diff --git a/src/math/hypotf.c b/src/math/hypotf.c
index 9fd77e6a..4d80178d 100644
--- a/src/math/hypotf.c
+++ b/src/math/hypotf.c
@@ -80,9 +80,7 @@ float hypotf(float x, float y)
 		t2 = a - t1;
 		w  = sqrtf(t1*y1-(w*(-w)-(t1*y2+t2*b)));
 	}
-	if (k != 0) {
-		SET_FLOAT_WORD(t1, 0x3f800000+(k<<23));
-		return t1*w;
-	}
+	if (k)
+		w = scalbnf(w, k);
 	return w;
 }