summaryrefslogtreecommitdiff
path: root/sysdeps/ieee754/dbl-64/e_hypot.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/ieee754/dbl-64/e_hypot.c')
-rw-r--r--sysdeps/ieee754/dbl-64/e_hypot.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/sysdeps/ieee754/dbl-64/e_hypot.c b/sysdeps/ieee754/dbl-64/e_hypot.c
index f142c450a2..a2c33cc4ed 100644
--- a/sysdeps/ieee754/dbl-64/e_hypot.c
+++ b/sysdeps/ieee754/dbl-64/e_hypot.c
@@ -44,6 +44,7 @@
#include <math.h>
#include <math_private.h>
+#include <math-underflow.h>
double
__ieee754_hypot (double x, double y)
@@ -74,8 +75,10 @@ __ieee754_hypot (double x, double y)
{
if (ha >= 0x7ff00000) /* Inf or NaN */
{
- u_int32_t low;
+ uint32_t low;
w = a + b; /* for sNaN */
+ if (issignaling (a) || issignaling (b))
+ return w;
GET_LOW_WORD (low, a);
if (((ha & 0xfffff) | low) == 0)
w = a;
@@ -93,7 +96,7 @@ __ieee754_hypot (double x, double y)
{
if (hb <= 0x000fffff) /* subnormal b or 0 */
{
- u_int32_t low;
+ uint32_t low;
GET_LOW_WORD (low, b);
if ((hb | low) == 0)
return a;
@@ -130,7 +133,7 @@ __ieee754_hypot (double x, double y)
t1 = 0;
SET_HIGH_WORD (t1, ha);
t2 = a - t1;
- w = __ieee754_sqrt (t1 * t1 - (b * (-b) - t2 * (a + t1)));
+ w = sqrt (t1 * t1 - (b * (-b) - t2 * (a + t1)));
}
else
{
@@ -141,11 +144,11 @@ __ieee754_hypot (double x, double y)
t1 = 0;
SET_HIGH_WORD (t1, ha + 0x00100000);
t2 = a - t1;
- w = __ieee754_sqrt (t1 * y1 - (w * (-w) - (t1 * y2 + t2 * b)));
+ w = sqrt (t1 * y1 - (w * (-w) - (t1 * y2 + t2 * b)));
}
if (k != 0)
{
- u_int32_t high;
+ uint32_t high;
t1 = 1.0;
GET_HIGH_WORD (high, t1);
SET_HIGH_WORD (t1, high + (k << 20));